Skip to content

Commit

Permalink
Fix a potential memory leak in get_conf_int
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Nov 30, 2013
1 parent 3d011a0 commit 228c226
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/usb_moded-config.c
Expand Up @@ -188,7 +188,7 @@ static int get_conf_int(const gchar *entry, const gchar *key)
{
GKeyFile *settingsfile;
gboolean test = FALSE;
gchar **keys;
gchar **keys, **origkeys;
int ret = 0;

settingsfile = g_key_file_new();
Expand All @@ -201,6 +201,7 @@ static int get_conf_int(const gchar *entry, const gchar *key)
keys = g_key_file_get_keys (settingsfile, entry, NULL, NULL);
if(keys == NULL)
return ret;
origkeys = keys;
while (*keys != NULL)
{
if(!strcmp(*keys, key))
Expand All @@ -210,7 +211,7 @@ static int get_conf_int(const gchar *entry, const gchar *key)
}
keys++;
}
//g_strfreev(keys);
g_strfreev(origkeys);
g_key_file_free(settingsfile);
return(ret);

Expand Down

0 comments on commit 228c226

Please sign in to comment.