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 ;-)
This commit is contained in:
Pablo Neira Ayuso 2012-10-18 19:03:52 +02:00 committed by Pablo Neira Ayuso
parent 2ee7ecddeb
commit d49eb74732
1 changed files with 9 additions and 5 deletions

View File

@ -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;
}