summaryrefslogtreecommitdiffstats
path: root/gisi
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-03-16 17:34:49 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-03-16 17:34:49 -0500
commit9b8d8218a52b02b87648c306c8692daee205509b (patch)
tree985d9afe7622e6cc4d07439a2d59a20ae34eb35c /gisi
parentd081e3910a5ddd1ce7840e8db25ee6d9f0c7a465 (diff)
downloadofono-9b8d8218a52b02b87648c306c8692daee205509b.tar.bz2
Fix: Use g_try_malloc not g_malloc in isi/pep.c
Diffstat (limited to 'gisi')
-rw-r--r--gisi/pep.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gisi/pep.c b/gisi/pep.c
index 45a91251..f1fe238e 100644
--- a/gisi/pep.c
+++ b/gisi/pep.c
@@ -72,10 +72,10 @@ static gboolean g_isi_pep_callback(GIOChannel *channel, GIOCondition cond,
GIsiPEP *g_isi_pep_create(GIsiModem *modem, GIsiPEPCallback cb, void *opaque)
{
- GIsiPEP *pep = g_malloc(sizeof(*pep));
+ unsigned ifi = g_isi_modem_index(modem);
+ GIsiPEP *pep = NULL;
GIOChannel *channel;
int fd;
- unsigned ifi = g_isi_modem_index(modem);
char buf[IF_NAMESIZE];
fd = socket(PF_PHONET, SOCK_SEQPACKET, 0);
@@ -91,6 +91,10 @@ GIsiPEP *g_isi_pep_create(GIsiModem *modem, GIsiPEPCallback cb, void *opaque)
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, buf, IF_NAMESIZE) != 0)
goto error;
+ pep = g_try_malloc(sizeof(GIsiPEP));
+ if (pep == NULL)
+ goto error;
+
pep->ready = cb;
pep->opaque = opaque;
pep->gprs_fd = -1;