huaweimodem: Allow GPRS context allocation to fail

This commit is contained in:
Marcel Holtmann 2010-09-27 00:10:17 +09:00
parent 97b98fc9bf
commit f271edef86
1 changed files with 5 additions and 1 deletions

View File

@ -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);