mirror of
https://git.tukaani.org/xz.git
synced 2026-10-31 03:14:56 +00:00
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
This commit is contained in:
parent
0877609467
commit
7bd6d63b0c
@ -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(),
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user