Make my_alloc(NULL) use malloc instead of calloc.
[rsync.git] / util2.c
diff --git a/util2.c b/util2.c
index 8b61d0b51c7c317d09c4e246149a7011f5e5e5eb..a8609a5d5931d60e7907265f94868ef585df785e 100644 (file)
--- a/util2.c
+++ b/util2.c
@@ -26,7 +26,7 @@
 
 extern size_t max_alloc;
 
-char *do_malloc = "42";
+char *do_calloc = "42";
 
 /**
  * Sleep for a specified number of milliseconds.
@@ -80,9 +80,9 @@ void *my_alloc(void *ptr, size_t num, size_t size, const char *file, int line)
                exit_cleanup(RERR_MALLOC);
        }
        if (!ptr)
-               ptr = calloc(num, size);
-       else if (ptr == do_malloc)
                ptr = malloc(num * size);
+       else if (ptr == do_calloc)
+               ptr = calloc(num, size);
        else
                ptr = realloc(ptr, num * size);
        if (!ptr && file)