mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-04 16:55:14 +00:00
attach: and cgroup.c: be overly cautious
Realistically (as Dwight points out) it doesn't seem possible that getline won't return at least one line in this functions, however just to make absolutely sure we don't get a segv on free(NULL), check line != NULL before freeing it on exit. Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
20fe4e8feb
commit
fa9ac567a7
@ -114,7 +114,8 @@ struct lxc_proc_context_info *lxc_proc_get_context_info(pid_t pid)
|
||||
}
|
||||
}
|
||||
|
||||
free(line);
|
||||
if (line)
|
||||
free(line);
|
||||
fclose(proc_file);
|
||||
|
||||
if (!found) {
|
||||
|
@ -503,7 +503,8 @@ static char *get_all_cgroups(void)
|
||||
}
|
||||
|
||||
out:
|
||||
free(line);
|
||||
if (line)
|
||||
free(line);
|
||||
fclose(f);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user