diff options
author | Dmitri Pal <dpal@redhat.com> | 2010-06-10 12:35:05 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-06-28 08:38:14 -0400 |
commit | db4132d61c290116cd74fcc4d32b5a7f25676be5 (patch) | |
tree | 46afd6b20e40d86c48fea9d657a99ff076595c37 /ini/ini_get_array.c | |
parent | fefab388e9122a3d61cebdddd9ef128347e3c864 (diff) | |
download | ding-libs-db4132d61c290116cd74fcc4d32b5a7f25676be5.tar.gz ding-libs-db4132d61c290116cd74fcc4d32b5a7f25676be5.tar.xz ding-libs-db4132d61c290116cd74fcc4d32b5a7f25676be5.zip |
Memory leak in case of empty valuesplit
Addressing coverity issue. Ticket #513.
The memory was really leaked when
the configuration value was empty.
Added unit test that confirmed the bug.
MANUAL MERGE.
Diffstat (limited to 'ini/ini_get_array.c')
-rw-r--r-- | ini/ini_get_array.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ini/ini_get_array.c b/ini/ini_get_array.c index c2c6362..b2cbfac 100644 --- a/ini/ini_get_array.c +++ b/ini/ini_get_array.c @@ -162,6 +162,8 @@ static char **get_str_cfg_array(struct collection_item *item, if (error) *error = EOK; if (size) *size = count; + /* If count is 0 the copy needs to be freed */ + if (count == 0) free(copy); TRACE_FLOW_STRING("get_str_cfg_array", "Exit"); return array; } |