Skip to content

Commit

Permalink
Don't leak our partition table structures.
Browse files Browse the repository at this point in the history
Covscan once more.

Signed-off-by: Peter Jones <[email protected]>
  • Loading branch information
vathpela committed Sep 10, 2014
1 parent 3cdcc7e commit 38fa9b2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ gpt_disk_get_partition_info(int fd,
{
gpt_header *gpt = NULL;
gpt_entry *ptes = NULL, *p;
int rc = 0;

if (!find_valid_gpt(fd, &gpt, &ptes))
return 1;
Expand All @@ -628,9 +629,14 @@ gpt_disk_get_partition_info(int fd,
sizeof (p->unique_partition_guid));
} else {
fprintf (stderr,"partition %d is not valid\n", num);
return 1;
rc = 1;
}
return 0;
if (ptes)
free(ptes);
if (gpt)
free(gpt);

return rc;
}

/*
Expand Down

0 comments on commit 38fa9b2

Please sign in to comment.