The branch, master has been updated
       via  a16477e6e62 registry: Free memory at the end of each loop run to 
prevent mem leak
      from  897c36f2cb7 torture: SMB1 unlink needs delay for a stream's 
SHARING_VIOLATION

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a16477e6e62b5525f6d8ddc297da2ec1ac176acc
Author: Swen Schillig <[email protected]>
Date:   Mon Jul 29 15:27:58 2019 +0200

    registry: Free memory at the end of each loop run to prevent mem leak
    
    Found during torture test runs with enable address-sanitizer.
    
    Signed-off-by: Swen Schillig <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    Reviewed-by: Andrew Bartlett <[email protected]>
    
    Autobuild-User(master): Andrew Bartlett <[email protected]>
    Autobuild-Date(master): Thu Aug  8 06:44:12 UTC 2019 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 source4/lib/registry/patchfile_preg.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/registry/patchfile_preg.c 
b/source4/lib/registry/patchfile_preg.c
index ba8ac3a5c38..1897e2c55f5 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -221,9 +221,6 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
        char *buf_ptr;
        TALLOC_CTX *mem_ctx = talloc_init("reg_preg_diff_load");
        WERROR ret = WERR_OK;
-       DATA_BLOB data = {NULL, 0};
-       char *key = NULL;
-       char *value_name = NULL;
 
        buf = talloc_array(mem_ctx, char, buf_size);
        buf_ptr = buf;
@@ -249,6 +246,9 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
        /* Read the entries */
        while(1) {
                uint32_t value_type, length;
+               char *key = NULL;
+               char *value_name = NULL;
+               DATA_BLOB data = {NULL, 0};
 
                if (!W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr))) {
                        break;
@@ -372,13 +372,13 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                        callbacks->add_key(callback_data, key);
                        callbacks->set_value(callback_data, key, value_name,
                                             value_type, data);
-               }
+               }
+               TALLOC_FREE(key);
+               TALLOC_FREE(value_name);
+               data_blob_free(&data);
        }
 cleanup:
        close(fd);
-       talloc_free(data.data);
-       talloc_free(key);
-       talloc_free(value_name);
-       talloc_free(buf);
+       TALLOC_FREE(mem_ctx);
        return ret;
 }


-- 
Samba Shared Repository

Reply via email to