summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--locks/unix/proc_mutex.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 4a22ff882..4cc983c1d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
Changes with APR 0.9.4
+ *) Don't segfault trying to close a file in error paths of flock
+ and fcntl mutex creation. PR 19036 [Jeff Trawick]
+
*) Add %pT support to apr_snprintf() for printing an apr_os_thread_t.
[Jeff Trawick]
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c
index 70bf7da80..0a98e81f2 100644
--- a/locks/unix/proc_mutex.c
+++ b/locks/unix/proc_mutex.c
@@ -496,8 +496,9 @@ static apr_status_t proc_mutex_fcntl_cleanup(void *mutex_)
if (status != APR_SUCCESS)
return status;
}
- apr_file_close(mutex->interproc);
-
+ if (mutex->interproc) { /* if it was opened successfully */
+ apr_file_close(mutex->interproc);
+ }
return APR_SUCCESS;
}
@@ -609,7 +610,9 @@ static apr_status_t proc_mutex_flock_cleanup(void *mutex_)
if (status != APR_SUCCESS)
return status;
}
- apr_file_close(mutex->interproc);
+ if (mutex->interproc) { /* if it was opened properly */
+ apr_file_close(mutex->interproc);
+ }
unlink(mutex->fname);
return APR_SUCCESS;
}