Commit d4c320a5 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

pagemap: init pagemap entries array as NULL

There is call to close_page_read on open_pages_image_at failure,
also on failure of init_pagemaps. pmes[] is uninitialized here
and free_pagemaps() will try to walk them and call xfree().
Which surely would lead to crash.

pagemap.c:317:6: warning: Branch condition evaluates to a garbage value
        if (pr->pmes)
            ^~~~~~~~
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 27994548
......@@ -436,6 +436,7 @@ int open_page_read_at(int dfd, int pid, struct page_read *pr, int pr_flags)
pr->pi_off = 0;
pr->bunch.iov_len = 0;
pr->bunch.iov_base = NULL;
pr->pmes = NULL;
pr->pmi = open_image_at(dfd, i_typ, O_RSTR, (long)pid);
if (!pr->pmi)
......
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