diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-04-02 19:06:31 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-04-02 19:06:31 -0700 |
commit | 4733ddaffaaf81cc7ccd5c099c0afd0a99512d1e (patch) | |
tree | 85354e78bc95036f74eed46b3e10e5e5ecf80e6c /gatchat/gatppp.c | |
parent | 9d8e55d489372c3fb3dcda08e5c281adb3aacb86 (diff) | |
download | ofono-4733ddaffaaf81cc7ccd5c099c0afd0a99512d1e.tar.bz2 |
Move frame NULL checks into the unstuffing function
Diffstat (limited to 'gatchat/gatppp.c')
-rw-r--r-- | gatchat/gatppp.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c index 6c846025..b5e9d3e5 100644 --- a/gatchat/gatppp.c +++ b/gatchat/gatppp.c @@ -179,9 +179,6 @@ static void ppp_recv(GAtPPP *ppp, struct frame_buffer *frame) guint protocol = ppp_proto(frame->bytes); guint8 *packet = ppp_info(frame->bytes); - if (!frame) - return; - switch (protocol) { case PPP_IP_PROTO: ppp_net_process_packet(ppp->net, packet); @@ -203,8 +200,6 @@ static void ppp_recv(GAtPPP *ppp, struct frame_buffer *frame) lcp_protocol_reject(ppp->lcp, frame->bytes, frame->len); break; }; - - g_free(frame); } /* XXX - Implement PFC and ACFC */ @@ -269,9 +264,11 @@ static void ppp_feed(GAtPPP *ppp, guint8 *data, gsize len) /* store last flag character & decode */ ppp->buffer[ppp->index++] = data[pos]; frame = ppp_decode(ppp, ppp->buffer); - - /* process receive frame */ - ppp_recv(ppp, frame); + if (frame) { + /* process receive frame */ + ppp_recv(ppp, frame); + g_free(frame); + } /* zero buffer */ memset(ppp->buffer, 0, BUFFERSZ); |