From bbedc3e1934278c2ff2746b25b688477cffc9d83 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 20 Dec 2013 18:31:35 -0600 Subject: [PATCH 1/1] create_temporary_file(): Fix use-after-free --- src/extract.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/extract.c b/src/extract.c index 59396717..3438ca73 100644 --- a/src/extract.c +++ b/src/extract.c @@ -1221,11 +1221,12 @@ retry: raw_fd = topen(name, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0600); if (raw_fd < 0) { - int errno_save = errno; - FREE(name); - if (errno_save == EEXIST) + if (errno == EEXIST) { + FREE(name); goto retry; + } ERROR_WITH_ERRNO("Failed to open temporary file \"%"TS"\"", name); + FREE(name); return WIMLIB_ERR_OPEN; } -- 2.43.0