[Commits] SDL: Fixed analyzer warning "Call to 'calloc' has an allocation ...

libsdl.org revision control commits-owner at libsdl.org
Mon Aug 28 00:54:05 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/1b4ef2593eca
changeset: 11385:1b4ef2593eca
user:      Sam Lantinga <slouken at libsdl.org>
date:      Mon Aug 28 00:54:02 2017 -0700
description:
Fixed analyzer warning "Call to 'calloc' has an allocation size of 0 bytes"

diffstat:

 src/video/SDL_vulkan_utils.c |  11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diffs (22 lines):

diff -r 269bdd5aa742 -r 1b4ef2593eca src/video/SDL_vulkan_utils.c
--- a/src/video/SDL_vulkan_utils.c	Mon Aug 28 00:51:14 2017 -0700
+++ b/src/video/SDL_vulkan_utils.c	Mon Aug 28 00:54:02 2017 -0700
@@ -133,14 +133,11 @@
     if(count == 0)
     {
         retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null
-        if(!retval)
-        {
-            SDL_OutOfMemory();
-            return NULL;
-        }
-        *extensionCount = 0;
     }
-    retval = SDL_calloc(count, sizeof(VkExtensionProperties));
+	else
+	{
+		retval = SDL_calloc(count, sizeof(VkExtensionProperties));
+	}
     if(!retval)
     {
         SDL_OutOfMemory();


More information about the commits mailing list