mirror of git://git.sysmocom.de/ofono
radio-settings: Fix memory leaks in radio_load_settings
Errors returned by g_key_file_get_integer have to be deallocated by the caller to avoid leaks like these: ==13330== 104 (24 direct, 80 indirect) bytes in 2 blocks are definitely lost ==13330== at 0x483F3EC: malloc (vg_replace_malloc.c) ==13330== by 0x4B020DF: g_malloc (gmem.c) ==13330== by 0x4B17F51: g_slice_alloc (gslice.c) ==13330== by 0x4AE80B9: g_error_new_valist (gerror.c) ==13330== by 0x4AE830B: g_set_error (gerror.c) ==13330== by 0x4AF5681: g_key_file_get_value (gkeyfile.c) ==13330== by 0x4AF6817: g_key_file_get_integer (gkeyfile.c) ==13330== by 0x10CFE3: radio_load_settings (radio-settings.c) ==13330== by 0x10D2E3: ofono_radio_settings_register (radio-settings.c)
This commit is contained in:
parent
417af0eaf2
commit
00613b5bbc
|
@ -856,9 +856,13 @@ static void radio_load_settings(struct ofono_radio_settings *rs,
|
|||
"GsmBand", rs->band_gsm);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
rs->pending_band_gsm = rs->band_gsm;
|
||||
|
||||
error = NULL;
|
||||
rs->band_umts = g_key_file_get_integer(rs->settings, SETTINGS_GROUP,
|
||||
"UmtsBand", &error);
|
||||
|
||||
|
@ -868,9 +872,13 @@ static void radio_load_settings(struct ofono_radio_settings *rs,
|
|||
"UmtsBand", rs->band_umts);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
rs->pending_band_umts = rs->band_umts;
|
||||
|
||||
error = NULL;
|
||||
rs->mode = g_key_file_get_integer(rs->settings, SETTINGS_GROUP,
|
||||
"TechnologyPreference", &error);
|
||||
|
||||
|
@ -880,6 +888,11 @@ static void radio_load_settings(struct ofono_radio_settings *rs,
|
|||
"TechnologyPreference", rs->mode);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
DBG("TechnologyPreference: %d", rs->mode);
|
||||
DBG("GsmBand: %d", rs->band_gsm);
|
||||
DBG("UmtsBand: %d", rs->band_umts);
|
||||
|
|
Loading…
Reference in New Issue