Skip to content

Commit 17189c6

Browse files
authored
fix: add null guard check in callback (#3499)
Signed-off-by: Alexandre Rulleau <[email protected]>
1 parent 9468244 commit 17189c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/sidecar.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static void dd_free_endpoints(void) {
6262
ddog_endpoint_drop(ddtrace_endpoint);
6363
ddog_endpoint_drop(dogstatsd_endpoint);
6464
ddtrace_endpoint = NULL;
65+
dogstatsd_endpoint = NULL;
6566
}
6667

6768
DDTRACE_PUBLIC const uint8_t *ddtrace_get_formatted_session_id(void) {
@@ -115,6 +116,10 @@ static void dd_sidecar_post_connect(ddog_SidecarTransport **transport, bool is_f
115116
}
116117

117118
static void dd_sidecar_on_reconnect(ddog_SidecarTransport *transport) {
119+
if (!ddtrace_endpoint || !dogstatsd_endpoint) {
120+
return;
121+
}
122+
118123
char logpath[MAXPATHLEN];
119124
int error_fd = atomic_load(&ddtrace_error_log_fd);
120125
if (error_fd == -1 || ddtrace_get_fd_path(error_fd, logpath) < 0) {

0 commit comments

Comments
 (0)