diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-03-16 17:34:49 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-03-16 17:34:49 -0500 |
commit | 9b8d8218a52b02b87648c306c8692daee205509b (patch) | |
tree | 985d9afe7622e6cc4d07439a2d59a20ae34eb35c /gisi/pep.c | |
parent | d081e3910a5ddd1ce7840e8db25ee6d9f0c7a465 (diff) | |
download | ofono-9b8d8218a52b02b87648c306c8692daee205509b.tar.gz |
Fix: Use g_try_malloc not g_malloc in isi/pep.c
Diffstat (limited to 'gisi/pep.c')
-rw-r--r-- | gisi/pep.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; |