summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2011-03-15 20:51:28 -0500
committerDenis Kenzior <denkenz@gmail.com>2011-03-15 20:51:28 -0500
commit788a91402e472976aebf68456816b121958acc26 (patch)
tree626f46f6a470a54d28512b7701f31d07be5a729f /src
parent9c2af56c18d222c1def2aa047d5a7ad367db2106 (diff)
downloadofono-788a91402e472976aebf68456816b121958acc26.tar.bz2
sim: Handle an error condition better
Diffstat (limited to 'src')
-rw-r--r--src/sim.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sim.c b/src/sim.c
index 46e63f4b..98d4cc40 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1285,14 +1285,15 @@ static void sim_efimg_read_cb(int ok, int length, int record,
if (sim->efimg == NULL) {
sim->efimg = g_try_malloc0(num_records * 9);
-
if (sim->efimg == NULL)
return;
sim->iidf_watch_ids = g_try_new0(unsigned int, num_records);
-
- if (sim->iidf_watch_ids == NULL)
+ if (sim->iidf_watch_ids == NULL) {
+ g_free(sim->efimg);
+ sim->efimg = NULL;
return;
+ }
sim->efimg_length = num_records * 9;
}