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/.
Neels Hofmeyr nhofmeyr at sysmocom.deOn Wed, Feb 24, 2016 at 10:04:40AM +0100, Harald Welte wrote:
> On Wed, Feb 24, 2016 at 03:39:35AM +0100, Neels Hofmeyr wrote:
> > + /* Avoid (small) mem leak: initially, vty_bind_addr is NULL. Whenever
> > + * this gets called, it is set to a strdup. So whenever it is non-NULL,
> > + * free it first. See also vty_get_bind_addr() for the NULL default. */
> > + if (vty_bind_addr) {
> > + talloc_free((void*)vty_bind_addr);
> > + vty_bind_addr = NULL;
> > + }
>
> free() on NULL is very well-defined and valid, so is talloc_free().
Really? Wasn't aware of that, indeed. Away with the ifs then.
I felt the comment should explain why I treat NULL as some default string
-- if I set vty_bind_addr = "127.0.0.1" then I can't free that string,
thus NULL. Hmm the comment sucks, yes.
Thanks!
~Neels
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20160224/f2193347/attachment.bin>