g_part_gpt: Fix memory leak in error path
If g_part_gpt_read() encountered a disk with bad primary and secondary tables, it could leak memory. Reported by: Coverity Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
21aa322881
commit
b3df8f9162
@ -923,6 +923,14 @@ g_part_gpt_read(struct g_part_table *basetable, struct g_consumer *cp)
|
||||
pp->name);
|
||||
printf("GEOM: %s: GPT rejected -- may not be recoverable.\n",
|
||||
pp->name);
|
||||
if (prihdr != NULL)
|
||||
g_free(prihdr);
|
||||
if (pritbl != NULL)
|
||||
g_free(pritbl);
|
||||
if (sechdr != NULL)
|
||||
g_free(sechdr);
|
||||
if (sectbl != NULL)
|
||||
g_free(sectbl);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user