]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_httpapi] Fix possible segfault when HEAD request fails
authorAlexander Udovichenko <udovichenko48@gmail.com>
Wed, 19 Mar 2025 21:01:35 +0000 (00:01 +0300)
committerGitHub <noreply@github.com>
Wed, 19 Mar 2025 21:01:35 +0000 (00:01 +0300)
src/mod/applications/mod_httapi/mod_httapi.c

index 1254a6f93cfd669fc3e00111ebeb08f5eacc992e..62cc55eeb9f8791b187cf8a81992843c0547f504 100644 (file)
@@ -2676,7 +2676,13 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char
                if (err_msg) {
                        *err_msg = "response code != 200";
                }
-               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);
+               
+               if (save_path) {
+                       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);
+               } else {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "head: url:%s failed with HTTP response code %d\n", url, (int)code);
+               }
+
                status = SWITCH_STATUS_FALSE;
                break;
        }