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