Skip to content

Commit

Permalink
irmap: Double close (USE_AFTER_FREE)
Browse files Browse the repository at this point in the history
CID 226478 (#1 of 2): Double close (USE_AFTER_FREE)
 Calling close(int) closes handle fd which has already been closed.

CID 226478 (#2 of 2): Double close (USE_AFTER_FREE)
 Calling close(int) closes handle fd which has already been closed.

Signed-off-by: Adrian Reber <areber@redhat.com>
  • Loading branch information
adrianreber authored and avagin committed Oct 20, 2020
1 parent 2ed1645 commit 7e4f50e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions criu/irmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ static int irmap_update_dir(struct irmap *t)
dfd = fdopendir(fd);
if (!dfd) {
pr_perror("Can't opendir %s", t->path);
close(fd);
return -1;
}

Expand Down Expand Up @@ -155,14 +156,12 @@ static int irmap_update_dir(struct irmap *t)
}

closedir(dfd);
close(fd);
t->nr_kids = nr;
return 0;

out_err:
xfree(t->kids);
closedir(dfd);
close(fd);
return -1;
}

Expand Down

0 comments on commit 7e4f50e

Please sign in to comment.