summaryrefslogtreecommitdiffstats
path: root/sbin/geom/class
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2017-04-26 14:50:06 +0000
committerasomers <asomers@FreeBSD.org>2017-04-26 14:50:06 +0000
commitf2d320b630bff35d490704e312716f86604633ef (patch)
tree93318074d7a43eed2796b5840eec466c85fd87a9 /sbin/geom/class
parent68f68f2b9f1b96d4fadc6e8a171c0345f4daf49e (diff)
downloadFreeBSD-src-f2d320b630bff35d490704e312716f86604633ef.zip
FreeBSD-src-f2d320b630bff35d490704e312716f86604633ef.tar.gz
MFC r316530, r316535
r316530: Fix clearing geom metadata if DIOCGSECTORSIZE fails An unhandled error case would result in passing SIZE_MAX to malloc. While I'm here, remove an unnecessary NULL check before free Reported by: Coverity CID: 1017793 Sponsored by: Spectra Logic Corp r316535: Fix memory leak in "gpart bootcode" Also, annotate that gpart_issue never returns Reported by: Coverity CID: 1007105 Sponsored by: Spectra Logic Corp
Diffstat (limited to 'sbin/geom/class')
-rw-r--r--sbin/geom/class/part/geom_part.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c
index 4f57f00..c6bd6d4 100644
--- a/sbin/geom/class/part/geom_part.c
+++ b/sbin/geom/class/part/geom_part.c
@@ -81,7 +81,7 @@ static int gpart_autofill(struct gctl_req *);
static int gpart_autofill_resize(struct gctl_req *);
static void gpart_bootcode(struct gctl_req *, unsigned int);
static void *gpart_bootfile_read(const char *, ssize_t *);
-static void gpart_issue(struct gctl_req *, unsigned int);
+static _Noreturn void gpart_issue(struct gctl_req *, unsigned int);
static void gpart_show(struct gctl_req *, unsigned int);
static void gpart_show_geom(struct ggeom *, const char *, int);
static int gpart_show_hasopt(struct gctl_req *, const char *, const char *);
@@ -1270,6 +1270,7 @@ gpart_bootcode(struct gctl_req *req, unsigned int fl)
gpart_issue(req, fl);
geom_deletetree(&mesh);
+ free(partcode);
}
static void
@@ -1290,7 +1291,7 @@ gpart_print_error(const char *errstr)
warnx("%s", errmsg);
}
-static void
+static _Noreturn void
gpart_issue(struct gctl_req *req, unsigned int fl __unused)
{
char buf[4096];
OpenPOWER on IntegriCloud