From patchwork Mon Nov 11 10:38:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13870550 Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E44D1953A9 for ; Mon, 11 Nov 2024 10:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731321541; cv=none; b=EYxuGN57+1+1Wblr73eHw0aEeyKuMGK4f+Ym4ATNUSDN/tB2RauYiP2C2Lgt/AzQuV4s/xjq6RPTE8K5oBRCSnj3g+FetzAXnsiJB/flNvjblKVRGzAS0yhN+1sVyUf90C/lGy0Xi3+k8EQunHo3utWxnfs23OXNSn9sAkPoQQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731321541; c=relaxed/simple; bh=0vE+5Hjk4VMl8Cj+au8Xskk9s+Orh5ppdeuFzdv/jis=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Og8C9M4NSrqPGEDiUVTYrkOi5aasY1TLoxuYKIRjym4HM5nWrw6uS7GKAz/HmLw3n+SVachVTtHu6r7MljRwfgk2sVdSgWQSwN5HnKxBPHmVbqga3L53CEGS5854WpgE2gHmXquuPGoEPgvY+iAXAo2v41N4dyg+6h6T+U6vLyE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=NDaqy5Q4; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=YONISayD; arc=none smtp.client-ip=103.168.172.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="NDaqy5Q4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="YONISayD" Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id CE0F0114015F; Mon, 11 Nov 2024 05:38:59 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Mon, 11 Nov 2024 05:38:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1731321539; x=1731407939; bh=Va50yG0d2x3d5zeob4vna9CM8w2Uy6vi83xNiJzS/nY=; b= NDaqy5Q44gMEeQE31WnumPknKK6VyuIch0e0oIl2+vPQoK7mu0SVezTKFTi4ozhL 8A42tXnjv0iztk3ouMollyg58B3RXaR8Kv8SzflDBnJ6t20DApnyEBiQ8IeDCNNn FE8aVvL9MozgBuoi9Nx8FPg/TeDxC32erP7+EfRyi138cEF/P3IP8C2TJqA9hoLm eZVzUDygfyj/dJLvt9JgoMrMrB32by8EoHOQA5DyebznSvKv8aSdK5dIII/yU8PU cnaO695OMrq+D8vCiveda5/ZTU+0yoCoe7PulrBtGmGbfi1uSU09WWwTJtWDFpsW Xt3XX6OEqH9fAsVnbDwzgQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731321539; x= 1731407939; bh=Va50yG0d2x3d5zeob4vna9CM8w2Uy6vi83xNiJzS/nY=; b=Y ONISayDZICdTbR1Ys3gWu7hcDb2a5FAUctHq+95s1OUrE8mrmr6BKqVrDEiK46u2 wxwaE835EO4zFufh7c2uJ7ZBOkAge5Je2XQk9nro8LCNLOJ2kPKooXj0mqDAynEk QQml/3/ss5JlnGN7a5Ru+r9Ziilvi1h7iYZEdNgqOqa+l2ZkDVSHrmUw2NjPleJ9 I5FbnpbxcPK4dQEMKepw/curuBejgo55P2jv2cuPslovr46XnVwc4LknbN4EQzt6 9EJ8Js5TPHVSatUT0HJ+vdT11JLIsVkuHBQQKezARK46lfFwhkkb6LhUbfFbhc9e tlaYCwwQEdpeMQP7fAIPQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddvgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeen ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkeduheej teekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepvddpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtoheprhhjuhhsthhosehgmhgrihhlrdgtohhmpdhrtghpth htohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 11 Nov 2024 05:38:59 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 5661ac61 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 11 Nov 2024 10:38:24 +0000 (UTC) From: Patrick Steinhardt Date: Mon, 11 Nov 2024 11:38:44 +0100 Subject: [PATCH v2 15/27] help: fix leaking `struct cmdnames` Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241111-b4-pks-leak-fixes-pt10-v2-15-6154bf91f0b0@pks.im> References: <20241111-b4-pks-leak-fixes-pt10-v2-0-6154bf91f0b0@pks.im> In-Reply-To: <20241111-b4-pks-leak-fixes-pt10-v2-0-6154bf91f0b0@pks.im> To: git@vger.kernel.org Cc: =?utf-8?q?Rub=C3=A9n_Justo?= X-Mailer: b4 0.14.2 We're populating multiple `struct cmdnames`, but don't ever free them. Plug this memory leak. Signed-off-by: Patrick Steinhardt --- help.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/help.c b/help.c index 8794f81db9bbf457b7cabca59222299922f3cc7f..8b56cd6e25ba5f2be2cbf2a7a9ed48136e12a0c7 100644 --- a/help.c +++ b/help.c @@ -723,6 +723,10 @@ const char *help_unknown_cmd(const char *cmd) (float)cfg.autocorrect/10.0, assumed); sleep_millisec(cfg.autocorrect * 100); } + + cmdnames_release(&cfg.aliases); + cmdnames_release(&main_cmds); + cmdnames_release(&other_cmds); return assumed; }