aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-18 20:25:07 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-18 20:25:07 +0200
commit46c40b8e584d98b621aa3195e3fc841f23b7140d (patch)
treeb0ea238345fa2aa1bfeb30563e4a9c88e05c4fec
parent3091e17571d839579ebb8dd83fd245ef878f2504 (diff)
ipa: Move the second null check into the first one
Move the second null check before we actually dereference the msg. Fixes: Coverity CID 1231854
-rw-r--r--src/input/ipa.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/input/ipa.c b/src/input/ipa.c
index eff01ce..e7ae6fb 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -66,14 +66,13 @@ int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg)
if (msg == NULL) {
msg = ipa_msg_alloc(0);
+ if (msg == NULL) {
+ ret = -ENOMEM;
+ goto discard_msg;
+ }
msg->l1h = msg->tail;
}
- if (msg == NULL) {
- ret = -ENOMEM;
- goto discard_msg;
- }
-
if (msg->l2h == NULL) {
/* first read our 3-byte header */
needed = sizeof(*hh) - msg->len;