From 214ef12cb504a0d61a598b5805d08b3c3fa11120 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Tue, 29 Aug 2023 20:14:19 +0200 Subject: [PATCH] [spotify] Fix free of invalid pointer on http request error Fixes #1643 --- src/inputs/librespot-c/librespot-c.h | 2 +- src/inputs/librespot-c/src/connection.c | 2 +- src/inputs/spotify_librespotc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/inputs/librespot-c/librespot-c.h b/src/inputs/librespot-c/librespot-c.h index eb3d91c8..39c69f91 100644 --- a/src/inputs/librespot-c/librespot-c.h +++ b/src/inputs/librespot-c/librespot-c.h @@ -6,7 +6,7 @@ #include #define LIBRESPOT_C_VERSION_MAJOR 0 -#define LIBRESPOT_C_VERSION_MINOR 1 +#define LIBRESPOT_C_VERSION_MINOR 2 struct sp_session; diff --git a/src/inputs/librespot-c/src/connection.c b/src/inputs/librespot-c/src/connection.c index 407f08b3..d021daf6 100644 --- a/src/inputs/librespot-c/src/connection.c +++ b/src/inputs/librespot-c/src/connection.c @@ -193,7 +193,7 @@ file_select(uint8_t *out, size_t out_len, Track *track, enum sp_bitrates bitrate static int ap_resolve(char **address, unsigned short *port, const char *avoid) { - char *body; + char *body = NULL; json_object *jresponse = NULL; json_object *ap_list; json_object *ap; diff --git a/src/inputs/spotify_librespotc.c b/src/inputs/spotify_librespotc.c index 890fcd8a..8c87d019 100644 --- a/src/inputs/spotify_librespotc.c +++ b/src/inputs/spotify_librespotc.c @@ -231,7 +231,7 @@ https_get_cb(char **out, const char *url) ret = http_client_request(&ctx, NULL); if (ret < 0 || ctx.response_code != HTTP_OK) { - DPRINTF(E_LOG, L_SPOTIFY, "Failed to AP list from '%s' (return %d, error code %d)\n", ctx.url, ret, ctx.response_code); + DPRINTF(E_LOG, L_SPOTIFY, "Failed to get AP list from '%s' (return %d, error code %d)\n", ctx.url, ret, ctx.response_code); goto error; }