From: Stéphane Graber Date: Wed, 19 Feb 2014 05:40:21 +0000 (-0500) Subject: coverity: rundir: Fix memory leaks X-Git-Tag: lxc-1.0.0.rc4~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd8c277753a6a1487a9e77b7d712db90dc70a3a4;p=thirdparty%2Flxc.git coverity: rundir: Fix memory leaks 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 --- 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);