mirror of git://git.sysmocom.de/ofono
qmimodem: Fix potential memory leak
In case strlen(ICCID) > 20, we simply return without freeing the ICCID value first.
This commit is contained in:
parent
4a93c329b9
commit
fbd9974998
|
@ -83,13 +83,13 @@ static void get_iccid_cb(struct qmi_result *result, void *user_data)
|
||||||
|
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
if (len > 20) {
|
if (len > 20) {
|
||||||
|
qmi_free(str);
|
||||||
CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data);
|
CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sim_encode_bcd_number(str, iccid);
|
sim_encode_bcd_number(str, iccid);
|
||||||
iccid_len = len / 2;
|
iccid_len = len / 2;
|
||||||
|
|
||||||
qmi_free(str);
|
qmi_free(str);
|
||||||
|
|
||||||
CALLBACK_WITH_SUCCESS(cb, iccid, iccid_len, cbd->data);
|
CALLBACK_WITH_SUCCESS(cb, iccid, iccid_len, cbd->data);
|
||||||
|
|
Loading…
Reference in New Issue