Skip to content

Commit 53953ec

Browse files
authored
fix null lock (microsoft#31)
1 parent 8821b2c commit 53953ec

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

apache2/apache2_util.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,17 @@ static int write_file_with_lock(apr_global_mutex_t* lock, apr_file_t* fd, char*
293293
int rc;
294294
apr_size_t nbytes, nbytes_written;
295295

296+
if (lock == NULL || fd == NULL || str == NULL) {
297+
return WAF_LOG_UTIL_FAILED;
298+
}
299+
296300
rc = apr_global_mutex_lock(lock);
297301
if (rc != APR_SUCCESS) {
298302
return WAF_LOG_UTIL_FAILED;
299303
}
300304

301-
if (fd != NULL) {
302-
nbytes = strlen(str);
303-
apr_file_write_full(fd, str, nbytes, &nbytes_written);
304-
}
305+
nbytes = strlen(str);
306+
apr_file_write_full(fd, str, nbytes, &nbytes_written);
305307

306308
rc = apr_global_mutex_unlock(lock);
307309
if (rc != APR_SUCCESS) {

0 commit comments

Comments
 (0)