From db4132d61c290116cd74fcc4d32b5a7f25676be5 Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Thu, 10 Jun 2010 12:35:05 -0400 Subject: Memory leak in case of empty value 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. --- ini/ini_get_array.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ini/ini_get_array.c') 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; } -- cgit