X-Git-Url: http://git.samba.org/samba.git/?p=bbaumbach%2Fsamba-autobuild%2F.git;a=blobdiff_plain;f=source4%2Flib%2Fregistry%2Fpatchfile_preg.c;fp=source4%2Flib%2Fregistry%2Fpatchfile_preg.c;h=1897e2c55f5258bcd9c161c7c0986dc7c30ce35b;hp=ba8ac3a5c38b87fdba4ca78ba9c8a7cc0c9867bc;hb=a16477e6e62b5525f6d8ddc297da2ec1ac176acc;hpb=897c36f2cb7de561394ab15e8134fb6e5b91ae63 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; }