From a221b104de5607f1e1dc0e9f0614b42424bb22ab Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 12 Nov 2019 23:09:55 +0000 Subject: [PATCH] sesutil: fix some memory leaks Reported by: Coverity Coverity CID: 1331665 MFC after: 2 weeks Sponsored by: Axcient --- usr.sbin/sesutil/sesutil.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/sesutil/sesutil.c b/usr.sbin/sesutil/sesutil.c index 7bc7d108d4b1..6f64bcd2a06e 100644 --- a/usr.sbin/sesutil/sesutil.c +++ b/usr.sbin/sesutil/sesutil.c @@ -242,18 +242,21 @@ sesled(int argc, char **argv, bool setfault) } if (ioctl(fd, ENCIOC_GETELMMAP, (caddr_t) objp) < 0) { + free(objp); close(fd); xo_err(EXIT_FAILURE, "ENCIOC_GETELMMAP"); } if (isses) { if (sesid >= nobj) { + free(objp); close(fd); xo_errx(EXIT_FAILURE, "Requested SES ID does not exist"); } do_led(fd, sesid, objp[sesid].elm_type, onoff, setfault); ndisks++; + free(objp); close(fd); break; }