From fd8c277753a6a1487a9e77b7d712db90dc70a3a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 19 Feb 2014 00:40:21 -0500 Subject: [PATCH] coverity: rundir: Fix memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we're no longer always returning a getenv result or some defined string, the callers should cleanup the variable after use. As a result, change from const char* to char*, add the needed free() everywhere and use strdup() on strings coming from getenv. Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- src/lxc/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/utils.h b/src/lxc/utils.h index f5412536f..f6f3373e4 100644 --- a/src/lxc/utils.h +++ b/src/lxc/utils.h @@ -39,7 +39,7 @@ extern void lxc_setup_fs(void); extern int get_u16(unsigned short *val, const char *arg, int base); extern int mkdir_p(const char *dir, mode_t mode); extern void remove_trailing_slashes(char *p); -extern const char *get_rundir(void); +extern char *get_rundir(void); extern const char *lxc_global_config_value(const char *option_name);