From 1715c377c2adf3b3c4c5aa56f1eda8c129b831dc Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 4 Oct 2016 14:31:28 +0900 Subject: [PATCH] ipath/ipath_debug: add a destructor for ipath_mylabel and keep valgrind happy --- ipath/ipath_debug.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ipath/ipath_debug.c b/ipath/ipath_debug.c index b89502f..61cb433 100644 --- a/ipath/ipath_debug.c +++ b/ipath/ipath_debug.c @@ -52,6 +52,7 @@ FILE *__ipath_dbgout; static void init_ipath_mylabel(void) __attribute__ ((constructor)); static void init_ipath_backtrace(void) __attribute__ ((constructor)); static void init_ipath_dbgfile(void) __attribute__ ((constructor)); +static void fini_ipath_mylabel(void) __attribute__ ((destructor)); static void fini_ipath_backtrace(void) __attribute__ ((destructor)); static void init_ipath_mylabel(void) @@ -80,6 +81,12 @@ static void init_ipath_mylabel(void) __ipath_mylabel = strdup(lbl); } +static void fini_ipath_mylabel(void) +{ + if (NULL != __ipath_mylabel) + free(__ipath_mylabel); +} + static void ipath_sighdlr(int sig, siginfo_t *p1, void *ucv) {