Fix for memory leak 22/112522/1
authorpr.jung <pr.jung@samsung.com>
Wed, 1 Feb 2017 08:37:56 +0000 (17:37 +0900)
committerpr.jung <pr.jung@samsung.com>
Wed, 1 Feb 2017 08:40:15 +0000 (17:40 +0900)
- gdbm_fetch returns a d_data and the actual value is in d_data.dptr
- Memory allocated to d_data.dptr needs to be freed

Change-Id: I774f2b16bbfbeb1cc500976aa266143aa56d5dbb
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/system_info.c

index a697eca..b819c5c 100644 (file)
@@ -138,6 +138,7 @@ static int db_get_value(enum tag_type tag, const char *key,
        }
 
        snprintf(value, len, "%s", d_data.dptr);
+       free(d_data.dptr);
        ret = SYSTEM_INFO_ERROR_NONE;
 
        g_hash_table_insert(hashtable, strdup(key_internal), strdup(value));