git: c16a901eac92 - stable/13 - sesutil: plug memory leaks
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Feb 2023 00:32:23 UTC
The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=c16a901eac92ca5dcb83509c432cabf36220920c commit c16a901eac92ca5dcb83509c432cabf36220920c Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2022-01-19 21:57:27 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2023-02-16 00:32:00 +0000 sesutil: plug memory leaks Sponsored by: Axcient Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D33955 (cherry picked from commit 09f29b03ddf857a366f338145693b5449e6ca5de) --- usr.sbin/sesutil/sesutil.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/sesutil/sesutil.c b/usr.sbin/sesutil/sesutil.c index 33303235a33c..fe74a8d8ce90 100644 --- a/usr.sbin/sesutil/sesutil.c +++ b/usr.sbin/sesutil/sesutil.c @@ -525,6 +525,7 @@ objmap(int argc, char **argv __unused) } print_extra_status(e_ptr[j].elm_type, e_status.cstat, PRINT_STYLE_DASHED); xo_close_instance("elements"); + free(e_desc.elm_desc_str); free(e_devname.elm_devnames); } xo_close_list("elements"); @@ -617,7 +618,7 @@ static void show_device(int fd, int elm_idx, encioc_elm_status_t e_status, encioc_elm_desc_t e_desc) { encioc_elm_devnames_t e_devname; - char *model, *serial; + char *model = NULL, *serial = NULL; off_t size; /* Get the device name(s) of the element */ @@ -634,8 +635,6 @@ show_device(int fd, int elm_idx, encioc_elm_status_t e_status, encioc_elm_desc_t (caddr_t) &e_devname) < 0) { /* We don't care if this fails */ e_devname.elm_devnames[0] = '\0'; - model = NULL; - serial = NULL; size = -1; } else { skip_pass_devices(e_devname.elm_devnames, 128); @@ -660,6 +659,8 @@ show_device(int fd, int elm_idx, encioc_elm_status_t e_status, encioc_elm_desc_t print_extra_status(ELMTYP_ARRAY_DEV, e_status.cstat, PRINT_STYLE_CSV); xo_emit("\n"); xo_close_instance("elements"); + free(serial); + free(model); free(e_devname.elm_devnames); } @@ -852,6 +853,7 @@ show(int argc, char **argv __unused) */ break; } + free(e_desc.elm_desc_str); } if (prev_type != (elm_type_t)-1 && prev_type != ELMTYP_DEVICE && prev_type != ELMTYP_ARRAY_DEV)