mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-05-30 13:12:46 +00:00
parse: fix uninitialized pointer access
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
This commit is contained in:
parent
8392708ef3
commit
af5e7ee11b
@ -81,12 +81,12 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
|
|||||||
ret = fstat(fd, &st);
|
ret = fstat(fd, &st);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
SYSERROR("Failed to stat config file \"%s\"", file);
|
SYSERROR("Failed to stat config file \"%s\"", file);
|
||||||
goto on_error;
|
goto on_error_fstat;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (st.st_size == 0)
|
if (st.st_size == 0)
|
||||||
goto on_error;
|
goto on_error_fstat;
|
||||||
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
buf = lxc_strmmap(NULL, st.st_size, PROT_READ | PROT_WRITE,
|
buf = lxc_strmmap(NULL, st.st_size, PROT_READ | PROT_WRITE,
|
||||||
@ -117,6 +117,7 @@ on_error:
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
on_error_fstat:
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
close(fd);
|
close(fd);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user