summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);