[PATCH] libbsc: fix message leaks on several error paths

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Peter Stuge peter at stuge.se
Tue Oct 16 16:46:05 UTC 2012


pablo at gnumonks.org wrote:
> @@ -671,9 +674,9 @@ 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;
>  	}

It looks like this is at the end of a switch () statement, so maybe
it is a good idea to include a goto statement for clarity, even if
that is not absolutely neccessary given how the code looks right now.


> -
> +err:
>  	msgb_free(msg);
>  	return rc;
>  }

Since the label is not only an error path but also reached during
successful flow through the function I suggest to name it something
like "done" instead.


Thanks a lot for fixing these leaks!


//Peter




More information about the OpenBSC mailing list