Commit 43285af9 authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

criu: parasite_prepare_threads: free memory on error path

Fixes cov 191305
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent eb8dc67f
......@@ -477,7 +477,7 @@ static int parasite_prepare_threads(struct parasite_ctl *ctl,
thread_sp = xzalloc(sizeof(*thread_sp) * item->nr_threads);
if (!thread_sp)
return -1;
goto free_ctls;
for (i = 0; i < item->nr_threads; i++) {
struct pid *tid = &item->threads[i];
......@@ -489,7 +489,7 @@ static int parasite_prepare_threads(struct parasite_ctl *ctl,
thread_ctls[i] = compel_prepare_thread(ctl, tid->real);
if (!thread_ctls[i])
return -1;
goto free_sp;
thread_sp[i] = compel_get_thread_sp(thread_ctls[i]);
}
......@@ -498,6 +498,12 @@ static int parasite_prepare_threads(struct parasite_ctl *ctl,
dmpi(item)->thread_sp = thread_sp;
return 0;
free_sp:
xfree(thread_sp);
free_ctls:
xfree(thread_ctls);
return -1;
}
struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
......
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