]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Return smartalloc buffers zeroed -- future performance improvement
authorKern Sibbald <kern@sibbald.com>
Mon, 11 May 2020 11:18:28 +0000 (13:18 +0200)
committerKern Sibbald <kern@sibbald.com>
Mon, 11 May 2020 11:18:28 +0000 (13:18 +0200)
bacula/src/lib/smartall.c

index afe5699436bdb7e6336f1ac877bfec36175a74fb..00a622e3192207bb1fc4459f33fd2386bc7090e7 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2017 Kern Sibbald
+   Copyright (C) 2000-2020 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.
@@ -256,9 +256,13 @@ void *sm_malloc(const char *fname, int lineno, unsigned int nbytes)
 
       /* To catch sloppy code that assumes  buffers  obtained  from
          malloc()  are  zeroed,  we  preset  the buffer contents to
-         "designer garbage" consisting of alternating bits.  */
+         "designer garbage" consisting of alternating bits.
 
-      memset(buf, 0x55, (int) nbytes);
+          Removed 10 May 2020 KES
+
+          memset(buf, 0x55, (int) nbytes);
+       */
+      memset(buf, 0, (int) nbytes);      /* clear the memory */
    } else {
       Emsg0(M_ABORT, 0, _("Out of memory\n"));
    }
@@ -329,7 +333,12 @@ void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size)
       /* If the new buffer is larger than the old, fill the balance
          of it with "designer garbage". */
       if (size > osize) {
-         memset(((char *) buf) + osize, 0x55, (int) (size - osize));
+         /*
+            Removed 10 May 2020 KES
+            memset(((char *) buf) + osize, 0x55, (int) (size - osize));
+         */
+
+         memset(((char *) buf) + osize, 0, (int) (size - osize));
       }
 
       /* All done.  Free and dechain the original buffer. */