aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2012-10-18 19:03:52 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-10-18 19:04:40 +0200
commitd49eb747325e2745fb3cfa6da9d63ec302b4dc9d (patch)
tree6b5e8ea952b0740daf4e97f5486279f852a01d9c /openbsc
parent2ee7ecddeb423dd8b2be984be58c5aee3b359a2f (diff)
libbsc: fix message leaks on several error paths
This patch fixes several leak of msgbs in uncommon error paths. Add break at the end of default to make Holger and Peter happy ;-)
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/libbsc/abis_nm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index e9dc1d6d6..4fd11c703 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -635,13 +635,16 @@ int abis_nm_rcvmsg(struct msgb *msg)
if (oh->placement != ABIS_OM_PLACEMENT_ONLY) {
LOGP(DNM, LOGL_ERROR, "ABIS OML placement 0x%x not supported\n",
oh->placement);
- if (oh->placement != ABIS_OM_PLACEMENT_FIRST)
- return -EINVAL;
+ if (oh->placement != ABIS_OM_PLACEMENT_FIRST) {
+ rc = -EINVAL;
+ goto err;
+ }
}
if (oh->sequence != 0) {
LOGP(DNM, LOGL_ERROR, "ABIS OML sequence 0x%x != 0x00\n",
oh->sequence);
- return -EINVAL;
+ rc = -EINVAL;
+ goto err;
}
#if 0
unsigned int l2_len = msg->tail - (uint8_t *)msgb_l2(msg);
@@ -671,9 +674,10 @@ int abis_nm_rcvmsg(struct msgb *msg)
default:
LOGP(DNM, LOGL_ERROR, "unknown ABIS OML message discriminator 0x%x\n",
oh->mdisc);
- return -EINVAL;
+ rc = -EINVAL;
+ break;
}
-
+err:
msgb_free(msg);
return rc;
}