diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-08-04 13:59:30 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-08-04 15:10:49 -0500 |
commit | 28817cc671aec687b3f1719b9ad2ff29bb4b444d (patch) | |
tree | 807583895cb93904e8bcb0a3fa5e7ff93feb267a | |
parent | 36a57c366d85c44555733f504bdfc08d60ca5914 (diff) | |
download | ofono-28817cc671aec687b3f1719b9ad2ff29bb4b444d.tar.bz2 |
Don't emit SubscriberNumbers multiple times
We would emit the signal even if the record could not be parsed
-rw-r--r-- | src/sim.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -191,7 +191,7 @@ static void sim_msisdn_read_cb(struct ofono_modem *modem, int ok, { struct sim_manager_data *sim = modem->sim_manager; int total; - struct ofono_phone_number *ph; + struct ofono_phone_number ph; if (!ok) goto check; @@ -204,15 +204,14 @@ static void sim_msisdn_read_cb(struct ofono_modem *modem, int ok, total = length / record_length; - ph = g_new(struct ofono_phone_number, 1); + if (sim_adn_parse(data, record_length, &ph) == TRUE) { + struct ofono_phone_number *own; - if (sim_adn_parse(data, record_length, ph) == FALSE) { - g_free(ph); - goto check; + own = g_new(struct ofono_phone_number, 1); + memcpy(own, &ph, sizeof(struct ofono_phone_number)); + sim->own_numbers = g_slist_prepend(sim->own_numbers, own); } - sim->own_numbers = g_slist_prepend(sim->own_numbers, ph); - if (record != total) return; |