Merge pull request #1638 from 0x0916/fix-memory-resource-leak

fix memory and resource leak
This commit is contained in:
Christian Brauner 2017-06-23 15:34:15 +02:00 committed by GitHub
commit af36a8ee9c
2 changed files with 4 additions and 1 deletions

View File

@ -207,6 +207,7 @@ static struct lxc_proc_context_info *lxc_proc_get_context_info(pid_t pid)
info = calloc(1, sizeof(*info)); info = calloc(1, sizeof(*info));
if (!info) { if (!info) {
SYSERROR("Could not allocate memory."); SYSERROR("Could not allocate memory.");
fclose(proc_file);
return NULL; return NULL;
} }

View File

@ -754,8 +754,10 @@ int do_mkfs_exec_wrapper(void *args)
return -1; return -1;
ret = snprintf(mkfs, len, "mkfs.%s", data[0]); ret = snprintf(mkfs, len, "mkfs.%s", data[0]);
if (ret < 0 || (size_t)ret >= len) if (ret < 0 || (size_t)ret >= len) {
free(mkfs);
return -1; return -1;
}
TRACE("executing \"%s %s\"", mkfs, data[1]); TRACE("executing \"%s %s\"", mkfs, data[1]);
execlp(mkfs, mkfs, data[1], (char *)NULL); execlp(mkfs, mkfs, data[1], (char *)NULL);