Date: Wed, 7 Mar 2018 01:55:50 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330562 - head/sys/geom/part Message-ID: <201803070155.w271toiB067626@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Wed Mar 7 01:55:50 2018 New Revision: 330562 URL: https://svnweb.freebsd.org/changeset/base/330562 Log: 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 Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Wed Mar 7 01:55:38 2018 (r330561) +++ head/sys/geom/part/g_part_gpt.c Wed Mar 7 01:55:50 2018 (r330562) @@ -923,6 +923,14 @@ g_part_gpt_read(struct g_part_table *basetable, struct 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803070155.w271toiB067626>