mtd: sf: Make sf_mtd.c more robust
[platform/kernel/u-boot.git] / common / malloc_simple.c
index c14f8b5..871b544 100644 (file)
@@ -57,7 +57,8 @@ void *calloc(size_t nmemb, size_t elem_size)
        void *ptr;
 
        ptr = malloc(size);
-       memset(ptr, '\0', size);
+       if (ptr)
+               memset(ptr, '\0', size);
 
        return ptr;
 }