From 9b8d8218a52b02b87648c306c8692daee205509b Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 16 Mar 2010 17:34:49 -0500 Subject: [PATCH] Fix: Use g_try_malloc not g_malloc in isi/pep.c --- gisi/pep.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gisi/pep.c b/gisi/pep.c index 45a9125..f1fe238 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; -- 2.7.4