From 28817cc671aec687b3f1719b9ad2ff29bb4b444d Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 4 Aug 2009 13:59:30 -0500 Subject: Don't emit SubscriberNumbers multiple times We would emit the signal even if the record could not be parsed --- src/sim.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/sim.c b/src/sim.c index 30c94739..8ef1c269 100644 --- a/src/sim.c +++ b/src/sim.c @@ -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; -- cgit v1.2.3