From 6268f6a67730efffa32c61f54f826251445c821a Mon Sep 17 00:00:00 2001 From: Justin Kenyon Date: Thu, 5 Feb 2026 23:20:38 -0500 Subject: [PATCH] Fix crash in rtspcl_auth_setup when response body is empty When connecting to Shairport Sync devices that return an empty body (Content-Length: 0) for the /auth-setup request, the 'rsp' pointer was never assigned but was still freed at the end of the function, causing a malloc error: 'pointer being freed was not allocated'. This fix initializes 'rsp' to NULL and 'rsp_len' to 0, so that free(rsp) is safe when no response body is received. Fixes streaming to JukeAudio whole-house audio systems using Shairport Sync 4.1.1. --- src/rtsp_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rtsp_client.c b/src/rtsp_client.c index eeb6c180..94bad403 100644 --- a/src/rtsp_client.c +++ b/src/rtsp_client.c @@ -501,8 +501,8 @@ bool rtspcl_auth_setup(struct rtspcl_s *p) { if (!p) return false; uint8_t secret[SECRET_KEY_SIZE], * pub_key = malloc(PUBLIC_KEY_SIZE + 1); - uint8_t* rsp; - int rsp_len; + uint8_t* rsp = NULL; // Initialize to NULL - may not be set if no response body + int rsp_len = 0; // create a verification public key RAND_bytes(secret, SECRET_KEY_SIZE);