mirror of git://git.sysmocom.de/ofono
radio-settings: Fix potential leak
rs->imsi is only freed when rs->settings is true. So tweak the logic inside radio_load_settings to only strdup the imsi when settings creation has succeeded.
This commit is contained in:
parent
77a3c58148
commit
b708f9f6b3
|
@ -811,8 +811,7 @@ static void radio_load_settings(struct ofono_radio_settings *rs,
|
|||
GError *error;
|
||||
char *strmode;
|
||||
|
||||
rs->imsi = g_strdup(imsi);
|
||||
rs->settings = storage_open(rs->imsi, SETTINGS_STORE);
|
||||
rs->settings = storage_open(imsi, SETTINGS_STORE);
|
||||
|
||||
/*
|
||||
* If no settings present or error; Set default.
|
||||
|
@ -824,6 +823,8 @@ static void radio_load_settings(struct ofono_radio_settings *rs,
|
|||
return;
|
||||
}
|
||||
|
||||
rs->imsi = g_strdup(imsi);
|
||||
|
||||
error = NULL;
|
||||
strmode = g_key_file_get_string(rs->settings, SETTINGS_GROUP,
|
||||
"TechnologyPreference", &error);
|
||||
|
|
Loading…
Reference in New Issue