[PATCH 1/3] vty: add bind command for telnet vty line

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

Harald Welte laforge at gnumonks.org
Wed Feb 24 09:04:40 UTC 2016


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().  So
maybe just unconditionally talloc_free it and avoid three lines of code
and three lines of comments?

You can keep it the way it is, but I fond it unusually verbose.

-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)



More information about the OpenBSC mailing list