From nobody Thu Jan 26 19:25:49 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 4P2rK96dNtz3bTdj; Thu, 26 Jan 2023 19:25:49 +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 4P2rK95t3gz4J94; Thu, 26 Jan 2023 19:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674761149; 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=nqyhKCjzhnoW97q+BCTaZxUddObiOwSis6nBgmfQx7w=; b=Qe4Bk2Qm2Ol41BPDZJTr+A+1P9UhuEx74aQIMpvj59ViQ6eEmwQMOY8N0reTRUPr8T2mA4 ctL3zvIPAEjDixd2C+cu7/myuL9KM46Z9F/3ipwOpKj4vZSgFtQXHmqzT0w8HqlEzbooJm 8u3qBX2ftl3LL68CCsnwtQxBksLHWn1wHFm/Ieisaur1yhLnJ/6GzFLlyp7zfgmUnYiJbL OsWgMermFqtBXltex1Ss6F5NwUv/a7UomUM7CypwT2aEow98S5U3b3PuZ/J6N9/LaIvZAa FxczrfEHMQeFH4OwnMDd1y2UDVnufttszy3FksoMPEVAQwRS+DH1UHDpFc75Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674761149; 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=nqyhKCjzhnoW97q+BCTaZxUddObiOwSis6nBgmfQx7w=; b=j0FK4INwU7E7dds7HAeIBbEw8X59rHmbhAfonqwtHHsgmiP5xQsz58oYfyjYxFJShgOAla Bysclzi9ZssVRuTopoct8zr02QSahNhWTBTVmsxD+dJeDF07CYzw+CfcsVJuZAu4ZmkJBz 5+qBxFvJk9do2x/BAYzzTPXG1fHSml11PPaELt8H6lXd0F4gocx9THFduLVB8YNcGQcCf0 oRGW1KcuhmJdqoMooP3XotOJY/30JEQg0ziba/+e7bIpt6nRNM/NYIGei3csIBSYp+VuuN OKKbI/txW2nKC2z8FnVyvh1PUCRmd6OGNx89vc2K+TujKS4bOd98eEEBnyHEOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674761149; a=rsa-sha256; cv=none; b=j8gVCo43jYHqs+11lVJibG6MOv1PJ96J0SgqhArcTv2cZKxHgFd37kqmZ5v/q40KXjZk8P oMOwfYw/rcbuBACEQr9psW7i5xVW2qrJdyiv4VEpUk0mNuyvCObEdd6MTxvvq52mD4dmsv ivXICfNVxBeSzxK+8QSnFVfAsB8Hpa9bA08nB08uud9IbtUQOC7dew5XogsUn/78F3vy8d AGbzxELBmVLpeuJkjId3X7dYdxeNxtMz2XhrcTqZyvmf4gMF+tZCNPFmNzVc7Ax892qJvx bxKwsWaXrB4K0rlLo7AWvYapJ94UwLl99ovEIBnek3t6B/zgIxJ8kPRSJkWeww== 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 4P2rK94w5lzghF; Thu, 26 Jan 2023 19:25:49 +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 30QJPnHV077949; Thu, 26 Jan 2023 19:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30QJPnsj077948; Thu, 26 Jan 2023 19:25:49 GMT (envelope-from git) Date: Thu, 26 Jan 2023 19:25:49 GMT Message-Id: <202301261925.30QJPnsj077948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 62bed9d49e41 - stable/13 - bhyve: plug memory leak in topology_parse() 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 62bed9d49e418a48ca9bc36f5f7bc513c547c92f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=62bed9d49e418a48ca9bc36f5f7bc513c547c92f commit 62bed9d49e418a48ca9bc36f5f7bc513c547c92f Author: Andy Fiddaman AuthorDate: 2022-02-24 17:36:41 +0000 Commit: John Baldwin CommitDate: 2023-01-26 19:21:46 +0000 bhyve: plug memory leak in topology_parse() Reviewed by: jhb, rew Differential Revision: https://reviews.freebsd.org/D34301 (cherry picked from commit ad3da82996ffe8a7959fda4a84374b1907ebb116) --- usr.sbin/bhyve/bhyverun.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 4c2c07b934a7..70dd52c9b2b4 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -271,7 +271,7 @@ usage(int code) static int topology_parse(const char *opt) { - char *cp, *str; + char *cp, *str, *tofree; if (*opt == '\0') { set_config_value("sockets", "1"); @@ -281,7 +281,7 @@ topology_parse(const char *opt) return (0); } - str = strdup(opt); + tofree = str = strdup(opt); if (str == NULL) errx(4, "Failed to allocate memory"); @@ -303,11 +303,11 @@ topology_parse(const char *opt) else set_config_value("cpus", cp); } - free(str); + free(tofree); return (0); out: - free(str); + free(tofree); return (-1); }