]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: rundir: Fix memory leaks
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 19 Feb 2014 05:40:21 +0000 (00:40 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 19 Feb 2014 15:38:38 +0000 (10:38 -0500)
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 <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/utils.h

index f5412536f9fa1c2db283077c6882f4ae76a357db..f6f3373e4c17e47db5bcd6161a18c59c718f4eea 100644 (file)
@@ -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);