]> git.proxmox.com Git - mirror_lxc.git/commitdiff
parse: fix uninitialized pointer access
author2xsec <dh48.jeong@samsung.com>
Wed, 10 Oct 2018 06:00:45 +0000 (15:00 +0900)
committer2xsec <dh48.jeong@samsung.com>
Wed, 10 Oct 2018 06:00:45 +0000 (15:00 +0900)
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/lxc/parse.c

index 05764b964482e28ffaef5beab306aa7fc68365a0..2fdb18ec8087aa94352a4660b3a900e9ba903674 100644 (file)
@@ -81,12 +81,12 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
        ret = fstat(fd, &st);
        if (ret < 0) {
                SYSERROR("Failed to stat config file \"%s\"", file);
-               goto on_error;
+               goto on_error_fstat;
        }
 
        ret = 0;
        if (st.st_size == 0)
-               goto on_error;
+               goto on_error_fstat;
 
        ret = -1;
        buf = lxc_strmmap(NULL, st.st_size, PROT_READ | PROT_WRITE,
@@ -117,6 +117,7 @@ on_error:
                        ret = -1;
        }
 
+on_error_fstat:
        saved_errno = errno;
        close(fd);
        errno = saved_errno;