Commit 7bd6d63b for xz

commit 7bd6d63b0c0cf2a0c4b609014c49e66d5199e385
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   Tue Jul 21 13:32:05 2026 +0300

    xz: Free the filename allocated for --files or --files0

    This cleans up leak detection slightly. Otherwise it doesn't matter
    because xz is going to exit soon anyway.

    Reported-by: Phuc An
    Fixes: https://github.com/tukaani-project/xz/pull/232

diff --git a/src/xz/args.c b/src/xz/args.c
index 8a9f98dc..cf64380b 100644
--- a/src/xz/args.c
+++ b/src/xz/args.c
@@ -638,7 +638,7 @@ parse_real(args_info *args, int argc, char **argv)
 						"or '--files0'."));

 			if (optarg == NULL) {
-				args->files_name = stdin_filename;
+				args->files_name = (char *)stdin_filename;
 				args->files_file = stdin;
 			} else {
 				// If we are called from parse_environment(),
diff --git a/src/xz/args.h b/src/xz/args.h
index 7fdf37f1..19c12616 100644
--- a/src/xz/args.h
+++ b/src/xz/args.h
@@ -19,7 +19,7 @@ typedef struct {

 	/// Name of the file from which to read filenames. This is NULL
 	/// if --files or --files0 was not used.
-	const char *files_name;
+	char *files_name;

 	/// File opened for reading from which filenames are read. This is
 	/// non-NULL only if files_name is non-NULL.
diff --git a/src/xz/main.c b/src/xz/main.c
index 8cc3b740..5dabc5ae 100644
--- a/src/xz/main.c
+++ b/src/xz/main.c
@@ -335,8 +335,10 @@ main(int argc, char **argv)
 			run(name);
 		}

-		if (args.files_name != stdin_filename)
+		if (args.files_name != stdin_filename) {
 			(void)fclose(args.files_file);
+			free(args.files_name);
+		}
 	}

 #ifdef HAVE_DECODERS