1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

s4:registry - "patchfile_dotreg.c" - fix a memory leak

Here we allocate memory on the "NULL" context through "reg_val_data_string" on
each call of "set_value". So when we have written out the allocated data on the
specified file descriptor we should immediately free this memory! Otherwise we
may end up with a big memory consumption on big registry databases.
This commit is contained in:
Matthias Dieter Wallnöfer 2010-03-22 12:00:57 +01:00
parent 5f24bfb7b9
commit 93472b41de

View File

@ -61,10 +61,12 @@ static WERROR reg_dotreg_diff_set_value(void *_data, const char *path,
uint32_t value_type, DATA_BLOB value)
{
struct dotreg_data *data = (struct dotreg_data *)_data;
char *data_string = reg_val_data_string(NULL, data->iconv_convenience,
value_type, value);
W_ERROR_HAVE_NO_MEMORY(data_string);
fdprintf(data->fd, "\"%s\"=%s:%s\n",
value_name, str_regtype(value_type),
reg_val_data_string(NULL, data->iconv_convenience, value_type, value));
value_name, str_regtype(value_type), data_string);
talloc_free(data_string);
return WERR_OK;
}