Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Aug 2025 08:19:00 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Warner Losh <imp@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: bc598959090d - main - autofs: Plug memory leak
Message-ID:  <aJgrxGXSXTfbB9tv@kib.kiev.ua>
In-Reply-To: <202508100156.57A1uMoa022605@gitrepo.freebsd.org>
References:  <202508100156.57A1uMoa022605@gitrepo.freebsd.org>

index | next in thread | previous in thread | raw e-mail

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=bc598959090d43aa0fc6b91355979016a9449041
> 
> commit bc598959090d43aa0fc6b91355979016a9449041
> Author:     Enji Cooper <ngie@FreeBSD.org>
> AuthorDate: 2025-08-10 01:52:31 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> 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 for
>     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 = mkdir(partial, 0755);
>  		if (error != 0 && errno != EEXIST) {
>  			log_warn("cannot create %s", partial);
> -			return;
> +			break;
>  		}
>  	}
>  
Isn't there another leak, occuring when the first break in the loop is taken?
Then the 'partial' duped string is not freed.


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aJgrxGXSXTfbB9tv>