[ovs-dev] [PATCH 4/4] util: Fix potential leak of memory.

William Tu u9012063 at gmail.com
Mon Oct 30 17:27:55 UTC 2017

Clang reports potiential leak of memory pointed to by 'pname'.
We already free the previous subporgram name when setting the
new subprogram name, and once the running thread exits, the
name of the process will be free by the system.  Thus, we don't
need to explicitly free it, so exclude the clang analyzer as a

Signed-off-by: William Tu <u9012063 at gmail.com>
 lib/util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/util.c b/lib/util.c
index a26cd51dcf6d..7153e8b8a5b6 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -534,6 +534,7 @@ get_subprogram_name(void)
 set_subprogram_name(const char *subprogram_name)
+#ifndef __clang_analyzer__
     char *pname = xstrdup(subprogram_name ? subprogram_name : program_name);
@@ -544,6 +545,7 @@ set_subprogram_name(const char *subprogram_name)
     pthread_set_name_np(pthread_self(), pname);
 unsigned int

More information about the dev mailing list