]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
log: fix memory leak when using a log handler
authorVincent Bernat <bernat@luffy.cx>
Thu, 6 Jun 2013 21:23:13 +0000 (23:23 +0200)
committerVincent Bernat <bernat@luffy.cx>
Thu, 6 Jun 2013 21:23:33 +0000 (23:23 +0200)
This is quite important for liblldpctl.

NEWS
src/log.c

diff --git a/NEWS b/NEWS
index de1d29728583f87bf107505874574a070ee73c66..279c6b450f6496f1b8da1e27f16e5d8c47fb24e8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 lldpd (0.7.4)
   * Fixes:
     + Segfault in lldpcli.
+    + Memory leak in liblldpctl when using a custom log handler.
   * Features:
     + Allow to configure hold value from lldpcli (and hence the TTL).
     + Allow to configure pattern for valid interfaces from lldpcli.
index daad84d5b9d9d8eea95428577580d285e6b86193..a3eebfa18bbf645a26e3b4b0faa90e6845561023 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -131,6 +131,7 @@ vlog(int pri, const char *token, const char *fmt, va_list ap)
                char *result;
                if (vasprintf(&result, fmt, ap) != -1) {
                        logh(pri, result);
+                       free(result);
                        return;
                }
                /* Otherwise, fallback to output on stderr. */