summaryrefslogtreecommitdiffstats
path: root/drivers/huaweimodem
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-09-27 00:10:17 +0900
committerMarcel Holtmann <marcel@holtmann.org>2010-09-27 00:10:17 +0900
commitf271edef86ef10fdf335a57adcad97689e22a2bb (patch)
tree7d6c4c1957ae5894f96b6a6c734fcac8694795f1 /drivers/huaweimodem
parent97b98fc9bf5aeb2201f9634dd807fc6763173295 (diff)
downloadofono-f271edef86ef10fdf335a57adcad97689e22a2bb.tar.bz2
huaweimodem: Allow GPRS context allocation to fail
Diffstat (limited to 'drivers/huaweimodem')
-rw-r--r--drivers/huaweimodem/gprs-context.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/huaweimodem/gprs-context.c b/drivers/huaweimodem/gprs-context.c
index 7dcf9f4e..c36060b1 100644
--- a/drivers/huaweimodem/gprs-context.c
+++ b/drivers/huaweimodem/gprs-context.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <errno.h>
#include <glib.h>
@@ -301,7 +302,10 @@ static int huawei_gprs_context_probe(struct ofono_gprs_context *gc,
GAtChat *chat = data;
struct gprs_context_data *gcd;
- gcd = g_new0(struct gprs_context_data, 1);
+ gcd = g_try_new0(struct gprs_context_data, 1);
+ if (!gcd)
+ return -ENOMEM;
+
gcd->chat = g_at_chat_clone(chat);
ofono_gprs_context_set_data(gc, gcd);