From nobody Sun Aug 10 22:43:55 2025 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 4c0XrB1HCfz64wXX for ; Sun, 10 Aug 2025 22:44:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4c0Xr959lyz3bgp for ; Sun, 10 Aug 2025 22:44:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-320dfa8cfa3so3553451a91.3 for ; Sun, 10 Aug 2025 15:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1754865847; x=1755470647; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RJoohFkdApMlimJdnWWvkpUb2F799BbHfLijU+O2cC8=; b=qBztiq1r0jfQw5q9TONfZnq3iuTaxDmhKEYWmAB874AWeWEwrCH52RktqNIro7cD83 4nIK2LBeOOPmUrvKQiwIYmwmY1VO+0DIYzXN6OqO3ijh7/PQRkPZw8vxi92j4vE9+67Q 0x6uuzhyhHwxLM40tXnLyk3s7JQJRj0l3SXIP4LpR/mZfDiuCHjRkAhYwxkHmWhkkF7x T+t7T/sz+Nm+BpYtGrBQ/4XM0hJBPhMMEHD7MzovKMWRIH3puX81zueuC3eRRpL6b/aK 7KNCb5Q9KnNyWwDZRqEwXAc2VsgZkHHopS7fkF+an5tdh6Fba+LXlkvmP3KjJAHXOLfG sLxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754865847; x=1755470647; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RJoohFkdApMlimJdnWWvkpUb2F799BbHfLijU+O2cC8=; b=OiY5S64cFngjPrI7qcd9sn4SjFprUg+qHqw9GwNQxmX6jNcKMBEkf1ItnG42T00xho Kjmghs4+In9o5qfiW92tg8sxk4lBTmsg8uf67PKsAYJ6p1Vp6mNfL8zR0buUN8k55aT+ be8vNS32+ExEsqVPsFecr/lUmblrOtiXrG28maP5T2sEnGzTZ++Wyzt7Nw6fzWYx4Jqn fnysKm2r7geOL63EUBHt6D2Sl3djqWRclcJLwNxrCk6Pi9XXmb/o368wQpcSpddVKekz lAK1qxTEl1JOHXzXtRrMuH44t67Ygx9szQdvHRT+xF/A+g5KRixFscAjZkN3On3QD+7Y 58ZA== X-Forwarded-Encrypted: i=1; AJvYcCXdhMiX6Kko4l6dTX5ARTdLInj8G002xW3oXlxSQN8zNgcSX2gbG+9xWS8M23dob0FlntViFn98f+zymiHZGOhCblqD@freebsd.org X-Gm-Message-State: AOJu0YyeO5caeJ433REPeU0fUszN4kX8oejQmk9Ly+DALe2CQgbAL6r/ 2W0KlHU+UPBGs4WzbVbG7BhQ3qN0IYvP+O0B8uTjN/dkiXzSuiyBSHtmtKZ2esMnaeMEMavsFgF hLu9Tinkcvy2x7W75bEuaKXiTv+tCu843vENw/PdOiA== X-Gm-Gg: ASbGncvjHgNUKHOK8PlveGpHlDL6wy1Lf/hz6N/dDwtEm//WAg0qlhQQnxqcXBfTLYj IfUyZK9BsrAZmfoVvdaZPAk5MqfL/0VbVnlqjGzYTzwZPoV2+LxFidZ7o/9rDU47DuM26mRkmkw sk9ReP89t19MRAFKv3iO9N2NVu/Bn9FgQ4SiEfByaV+0uBQ+Jn9n+ehMCKbI9gA00wknUiujjjg YceE6U= X-Google-Smtp-Source: AGHT+IF12NqF4KNCBBTxZ2qLEkQQNpcaFHk0s/E6DMB+xFdhJ8Jj4zxdmfbVWo29vbvJ4tcRN5tF4GqMt1m6hOVFFeI= X-Received: by 2002:a17:90a:ec8e:b0:312:39c1:c9cf with SMTP id 98e67ed59e1d1-321839d783fmr15794207a91.7.1754865846776; Sun, 10 Aug 2025 15:44:06 -0700 (PDT) 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202508100156.57A1uMoa022605@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Sun, 10 Aug 2025 16:43:55 -0600 X-Gm-Features: Ac12FXxk58mA8bz71bxvxLYCtLVPCW41lsReC0LS9psVeH01rs019O9ceU9iWRI Message-ID: Subject: Re: git: bc598959090d - main - autofs: Plug memory leak To: Konstantin Belousov Cc: Warner Losh , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4c0Xr959lyz3bgp X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] On Sat, Aug 9, 2025 at 11:19=E2=80=AFPM Konstantin Belousov wrote: > > On Sun, Aug 10, 2025 at 01:56:22AM +0000, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dbc598959090d43aa0fc6b913= 55979016a9449041 > > > > commit bc598959090d43aa0fc6b91355979016a9449041 > > Author: Enji Cooper > > AuthorDate: 2025-08-10 01:52:31 +0000 > > Commit: Warner Losh > > CommitDate: 2025-08-10 01:54:42 +0000 > > > > autofs: Plug memory leak > > > > Originally, this was an extra free, but ngie@ suggested this > > change. Since that's the whole thing, I've set her as the author fo= r > > this ancient review instead of trix@juniper.net. > > > > Sugggested by: ngie > > Differential Revision: https://reviews.freebsd.org/D10063 > > Sponsored by: Netflix > > --- > > usr.sbin/autofs/common.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c > > index 18756752876c..6b98214162ae 100644 > > --- a/usr.sbin/autofs/common.c > > +++ b/usr.sbin/autofs/common.c > > @@ -149,7 +149,7 @@ create_directory(const char *path) > > error =3D mkdir(partial, 0755); > > if (error !=3D 0 && errno !=3D EEXIST) { > > log_warn("cannot create %s", partial); > > - return; > > + break; > > } > > } > > > Isn't there another leak, occuring when the first break in the loop is ta= ken? > Then the 'partial' duped string is not freed. I think it's always leaked. checked_strdup allocates it, then concat allocates a new string that's set to partial. So no matter what, we should free it, no? Eg diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c index 6b98214162ae..2dd7c290cebc 100644 --- a/usr.sbin/autofs/common.c +++ b/usr.sbin/autofs/common.c @@ -153,6 +153,7 @@ create_directory(const char *path) } } + free(partial); free(tofree); } Warner