Skip to content

Commit 13ed185

Browse files
jpnurmiclaude
andcommitted
fix: add null check after sentry__http_transport_new in default transport
If sentry__http_transport_new returns NULL, the subsequent set_* calls would dereference a null pointer. Free the client and return NULL early. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8c923e8 commit 13ed185

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/transports/sentry_http_transport_curl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ sentry__transport_new_default(void)
247247

248248
sentry_transport_t *transport
249249
= sentry__http_transport_new(client, curl_send_task);
250+
if (!transport) {
251+
curl_client_free(client);
252+
return NULL;
253+
}
250254
sentry__http_transport_set_free_client(transport, curl_client_free);
251255
sentry__http_transport_set_start_client(transport, curl_client_start);
252256
return transport;

src/transports/sentry_http_transport_winhttp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ sentry__transport_new_default(void)
324324

325325
sentry_transport_t *transport
326326
= sentry__http_transport_new(client, winhttp_send_task);
327+
if (!transport) {
328+
winhttp_client_free(client);
329+
return NULL;
330+
}
327331
sentry__http_transport_set_free_client(transport, winhttp_client_free);
328332
sentry__http_transport_set_start_client(transport, winhttp_client_start);
329333
sentry__http_transport_set_shutdown_client(

0 commit comments

Comments
 (0)