From nobody Thu Feb 16 00:32:23 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PHG9g4Ncmz3rYbB; Thu, 16 Feb 2023 00:32:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PHG9g2gxQz41bh; Thu, 16 Feb 2023 00:32:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676507543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/ZWCtExh2V2lSU7RDBZg4q+L0tMM6jFjhSsa3iHYYMk=; b=JYKw/Muxjhu7JsonAsOcWcHGWLZRTJKKWpsWQwNE9nf9niPX9X3U747pudvwHYr0Kln6qs FnSdGyBPgcdWCaw40EMgpSt3oyqGWA9D1/wUSOzd79jAoUSsk/44N1x37xka84KVrrB/Pe J0zMx0v44YnNrk7jeusi2RVzPZvUTkNlX9E+A2Vt/uDyEPkPPAM3hE0/QOPTIxUh10vSd4 SndzQ7oO7F5Ifg6fVzNaouI5lip8Kg0mOsBjSVRx2Kdp2sgR+uJdUdL7U4C3gsNYHKvUvh wMMKCrON4KxCoZTEhaMQEOI0srpNG2QNWG9PnZgq1bSdoIncfGRL8sxhJMXF/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676507543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/ZWCtExh2V2lSU7RDBZg4q+L0tMM6jFjhSsa3iHYYMk=; b=DZpdLQvvOOyysmwK+3iqnkL/8kzajerWNMf/cBcNTn/iVevvNUUg56m1oiqZIXebVTIawJ eWXlL0MOWTVOHGQB4V5EBLWsv+vUdXzAZtsGGAhY7fZvG7Y5ffjOgV1xLAfn++PoRJ/t0T 77CASZDfMW1DYm69ljhzLve2rhExt2NfdjuY8rcJ1PpZQVoF5PHZnCnwiF28U5+sHCVpGj K9+JiRpj9s1ZyhgpUEbc12ISc4hqxkLdALpd9Ky2eZZQyTNAFDgLvToBJwF67ZgvOHvKBO iw2370tic9hubg50onK6BANqfMLznq2SFzxG7+a8VRGUPSSP2AP+CaKL+BKBGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676507543; a=rsa-sha256; cv=none; b=gBb6p3bGPfTnbauj5X/Ae6hFr5y9H82azz0tpDbjKMJjylEyj2Ox9aQFJg7eQ+u1RguaP3 b8w8XiJPFNKocH4SDgO3s+XLF+R5uZRU9CpYjy14ZcEbxFSTJmCbYc72RxoZqBACgw3GUb BMdtheoNkojGh3iXxMkziIpEb6D8evkIHZDTXXzUF5tbrEyKJAYoDVidWIAsyYu1D26GxI NbiUlzsknMnQKXH0xJqjMLOoodcfK3pAWkKsWOHVpaHLEWJnAOCVKfEMRV6qiK9GVZusUa Sp5Qy/Ud5N+kyumRBihQZgM5giUsCbIsDLGHo6G83aPOr1iUKKLHZXbEkyQdQA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PHG9g1lGkzl1N; Thu, 16 Feb 2023 00:32:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31G0WNFe084109; Thu, 16 Feb 2023 00:32:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31G0WN84084108; Thu, 16 Feb 2023 00:32:23 GMT (envelope-from git) Date: Thu, 16 Feb 2023 00:32:23 GMT Message-Id: <202302160032.31G0WN84084108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: c16a901eac92 - stable/13 - sesutil: plug memory leaks List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c16a901eac92ca5dcb83509c432cabf36220920c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=c16a901eac92ca5dcb83509c432cabf36220920c commit c16a901eac92ca5dcb83509c432cabf36220920c Author: Alan Somers AuthorDate: 2022-01-19 21:57:27 +0000 Commit: Alan Somers 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)