summaryrefslogtreecommitdiffstats
path: root/src/sim.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-03-16 15:44:29 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-03-16 15:45:04 -0500
commit62007cd074e33e01e4c3f5336b1735a3d56d5292 (patch)
tree2f34b43901be7850b51d0600020ca7e95b1744da /src/sim.c
parentb0251791019b41c1cefa70d65613cef72516086a (diff)
downloadofono-62007cd074e33e01e4c3f5336b1735a3d56d5292.tar.bz2
Fix: Fixup error paths in sim_op_check_cached
Diffstat (limited to 'src/sim.c')
-rw-r--r--src/sim.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sim.c b/src/sim.c
index 03d3e6e4..cc258c80 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1502,6 +1502,9 @@ static gboolean sim_op_check_cached(struct ofono_sim *sim)
path = g_strdup_printf(SIM_CACHE_PATH, imsi, sim->phase, op->id);
+ if (path == NULL)
+ return FALSE;
+
fd = TFR(open(path, O_RDONLY));
g_free(path);
@@ -1537,7 +1540,10 @@ static gboolean sim_op_check_cached(struct ofono_sim *sim)
goto cleanup;
}
- buffer = g_malloc(file_length);
+ buffer = g_try_malloc(file_length);
+
+ if (buffer == NULL)
+ goto cleanup;
len = TFR(read(fd, buffer, file_length));