Commit 4b9b8271 for xz
commit 4b9b827117cecd7571c0952b501fa84c4bd7e5fb
Author: Lasse Collin <lasse.collin@tukaani.org>
Date: Tue Jul 21 13:50:13 2026 +0300
xz: Free the filename read from the file specified with --files/--files0
Like the previous commit, this cleans up leak detection slightly.
Otherwise it doesn't matter because xz is going to exit soon anyway.
diff --git a/src/xz/main.c b/src/xz/main.c
index 5dabc5ae..fe5ff4ad 100644
--- a/src/xz/main.c
+++ b/src/xz/main.c
@@ -89,7 +89,7 @@ read_name(const args_info *args)
message_error(_("%s: Error reading filenames: %s"),
tuklib_mask_nonprint(args->files_name),
strerror(errno));
- return NULL;
+ break;
}
if (feof(args->files_file)) {
@@ -99,7 +99,7 @@ read_name(const args_info *args)
tuklib_mask_nonprint(
args->files_name));
- return NULL;
+ break;
}
if (c == args->files_delim) {
@@ -125,7 +125,7 @@ read_name(const args_info *args)
"of '--files'?"),
tuklib_mask_nonprint(
args->files_name));
- return NULL;
+ break;
}
name[pos++] = c;
@@ -149,6 +149,8 @@ read_name(const args_info *args)
}
}
+ free(name);
+ name = NULL;
return NULL;
}