From a7b38080b5b69a31fe4ac5ff4249e1720e682068 Mon Sep 17 00:00:00 2001 From: Kichan Kwon Date: Fri, 1 Sep 2017 16:20:32 +0900 Subject: [PATCH] Fix memory issue about the value read by GDBM - Limit duplicated size - Free after using Change-Id: I530683f386bb64d402c8277824051c91aa003330 Signed-off-by: Kichan Kwon --- src/system_info.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/system_info.c b/src/system_info.c index acdb049..b580ed4 100644 --- a/src/system_info.c +++ b/src/system_info.c @@ -241,7 +241,9 @@ static int system_info_get_type(enum tag_type tag, const char *key, *type = info_type[i].type_e; ret = SYSTEM_INFO_ERROR_NONE; - g_hash_table_insert(hashtable, strdup(key_internal), strdup(d_data.dptr)); + g_hash_table_insert(hashtable, strndup(key_internal, d_key.dsize), + strndup(d_data.dptr, d_data.dsize)); + free(d_data.dptr); goto out; } } -- 2.7.4