[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/.

Pablo Neira Ayuso pablo at gnumonks.org
Thu Oct 18 12:19:43 UTC 2012


Hi Peter,

On Tue, Oct 16, 2012 at 06:46:05PM +0200, Peter Stuge wrote:
> 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.

at the risk of being annoying, I think the patch is good as is.

I don't want that this becomes a "bikeshed color" discussion [1], I
think the code changes are clear enough.

Thanks for your feedback.

[1] http://bikeshed.com/




More information about the OpenBSC mailing list