From e67e64ddefb993f7fdea4501f7efbe657cb0f164 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. --- common/ini/ini_get_array.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/ini/ini_get_array.c') diff --git a/common/ini/ini_get_array.c b/common/ini/ini_get_array.c index c2c6362a..b2cbfacf 100644 --- a/common/ini/ini_get_array.c +++ b/common/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