From: Karel Zak Date: Wed, 20 May 2026 10:44:11 +0000 (+0200) Subject: agetty: fix path_cxt leak in credential loading X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=c88bf7ff7aafa2129d76d6b6395e4b250aa92dcf;p=thirdparty%2Futil-linux.git agetty: fix path_cxt leak in credential loading The ul_new_path() result was never freed. Use goto to ensure ul_unref_path() is called on all exit paths. Signed-off-by: Karel Zak --- diff --git a/agetty-cmd/credentials.c b/agetty-cmd/credentials.c index 30b12f0f7..8a10b4b14 100644 --- a/agetty-cmd/credentials.c +++ b/agetty-cmd/credentials.c @@ -109,7 +109,7 @@ void agetty_load_credentials(struct agetty_options *op) dir = ul_path_opendir(pc, NULL); if (!dir) { agetty_log_warn(_("failed to open credentials directory")); - return; + goto out; } while ((d = xreaddir(dir))) { @@ -139,4 +139,6 @@ void agetty_load_credentials(struct agetty_options *op) &op->flags, F_ISSUE, 1); } closedir(dir); +out: + ul_unref_path(pc); }