Commit 6b83aef6 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

crtools: Merge fdset free into close

The same as previous patch -- no need in two separate calls.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 871b7367
......@@ -1257,12 +1257,10 @@ int cr_dump_tasks(pid_t pid, struct cr_options *opts)
goto err;
close_cr_fdset(cr_fdset_thread);
free_cr_fdset(&cr_fdset_thread);
}
}
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
if (opts->leader_only)
break;
......@@ -1282,10 +1280,7 @@ err:
free_pstree(&pstree_list);
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
close_cr_fdset(cr_fdset_thread);
free_cr_fdset(&cr_fdset_thread);
return ret;
}
......@@ -513,7 +513,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
show_pstree(cr_fdset->fds[CR_FD_PSTREE]);
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
list_for_each_entry(item, &pstree_list, list) {
......@@ -547,7 +546,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
pr_info("----------------------------------------\n");
close_cr_fdset(cr_fdset_th);
free_cr_fdset(&cr_fdset_th);
}
}
......@@ -562,7 +560,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
show_unixsk(cr_fdset->fds[CR_FD_UNIXSK]);
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
if (opts->leader_only)
break;
......@@ -571,7 +568,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
out:
free_pstree(&pstree_list);
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
return ret;
}
......
......@@ -195,14 +195,8 @@ void close_cr_fdset(struct cr_fdset *cr_fdset)
close(cr_fdset->fds[i]);
cr_fdset->fds[i] = -1;
}
}
void free_cr_fdset(struct cr_fdset **cr_fdset)
{
if (cr_fdset && *cr_fdset) {
free(*cr_fdset);
*cr_fdset = NULL;
}
free(cr_fdset);
}
int get_image_path(char *path, int size, const char *fmt, int pid)
......
......@@ -88,7 +88,6 @@ int convert_to_elf(char *elf_path, int fd_core);
struct cr_fdset *prep_cr_fdset_for_dump(int pid, unsigned long use_mask);
struct cr_fdset *prep_cr_fdset_for_restore(int pid, unsigned long use_mask);
void close_cr_fdset(struct cr_fdset *cr_fdset);
void free_cr_fdset(struct cr_fdset **cr_fdset);
void free_mappings(struct list_head *vma_area_list);
......
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