Commit fd8c2777 by Stéphane Graber

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: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 44b9ae4b
...@@ -39,7 +39,7 @@ extern void lxc_setup_fs(void); ...@@ -39,7 +39,7 @@ extern void lxc_setup_fs(void);
extern int get_u16(unsigned short *val, const char *arg, int base); extern int get_u16(unsigned short *val, const char *arg, int base);
extern int mkdir_p(const char *dir, mode_t mode); extern int mkdir_p(const char *dir, mode_t mode);
extern void remove_trailing_slashes(char *p); 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); extern const char *lxc_global_config_value(const char *option_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment