Skip to content

Commit a57c895

Browse files
[mod_httpapi] Fix possible segfault when HEAD request fails
1 parent e622a02 commit a57c895

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/mod/applications/mod_httapi/mod_httapi.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,13 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char
26762676
if (err_msg) {
26772677
*err_msg = "response code != 200";
26782678
}
2679-
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "caching: url:%s to %s failed with HTTP response code %d\n", url, save_path, (int)code);
2679+
2680+
if (save_path) {
2681+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "caching: url:%s to %s failed with HTTP response code %d\n", url, save_path, (int)code);
2682+
} else {
2683+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "head: url:%s failed with HTTP response code %d\n", url, (int)code);
2684+
}
2685+
26802686
status = SWITCH_STATUS_FALSE;
26812687
break;
26822688
}

0 commit comments

Comments
 (0)