]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/smartall.c
Big backport from Enterprise
[bacula/bacula] / bacula / src / lib / smartall.c
index 0d4ecb73accf255f2758a74363c7c89cabe11df2..61282d68a6b4646da9038441d5a0605e697a6dce 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2016 Kern Sibbald
+   Copyright (C) 2000-2017 Kern Sibbald
 
    The original author of Bacula is Kern Sibbald, with contributions
    from many others, a complete list can be found in the file AUTHORS.
@@ -109,7 +109,10 @@ static void *smalloc(const char *fname, int lineno, unsigned int nbytes)
       is desired than to miss all the erroneous occurrences where
       buffer length calculation code results in a zero.  */
 
-   ASSERT(nbytes > 0);
+   if (nbytes == 0) {
+      Tmsg3(0, "Invalid memory allocation. %u bytes %s:%d\n", nbytes, fname, lineno);
+      ASSERT(nbytes > 0);
+   }
 
    nbytes += HEAD_SIZE + 1;
    if ((buf = (char *)malloc(nbytes)) != NULL) {