There should only be one free() in the image_parse_tree() function because image_parse() always frees the pointer passed in as a parameter. Since the pointer is passed by value we can reuse variable "h" inside image_parse_tree() and image_parse() will still free the correct memory. Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx> --- ckptinfo.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ckptinfo.c b/ckptinfo.c index be1f89f..e7609c0 100644 --- a/ckptinfo.c +++ b/ckptinfo.c @@ -263,13 +263,14 @@ static int image_parse_tree(struct ckpt_hdr *h, int fd, struct args *args) hh = (struct ckpt_hdr_tree *) h; nr_tasks = hh->nr_tasks; - free(h); + h = NULL; ret = image_read_obj(fd, &h); if (ret == 0) fprintf(stderr, "process tree: unexpected end of file"); - if (ret <= 0) + if (!h || ret <= 0) { return -1; + } pp = (struct ckpt_pids *) h; -- 1.6.3.3 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers