1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-02-02 15:07:36 -05:00

Update: Unified freeing of client_queue_entry_t nodes

This commit is contained in:
Philipp Schafft 2022-03-19 19:15:34 +00:00
parent c34f715f0d
commit 2e0bb32535

View File

@ -116,6 +116,7 @@ rwlock_t _source_shutdown_rwlock;
static void _handle_connection(void); static void _handle_connection(void);
static void get_tls_certificate(ice_config_t *config); static void get_tls_certificate(ice_config_t *config);
static void free_client_node(client_queue_entry_t *node);
static void client_queue_init(client_queue_t *queue) static void client_queue_init(client_queue_t *queue)
{ {
@ -527,7 +528,7 @@ static bool process_request_queue_one (client_queue_entry_t *node, int timeout)
} else { } else {
if (len == 0 || client->con->error) { if (len == 0 || client->con->error) {
client_destroy(client); client_destroy(client);
free(node); free_client_node(node);
return true; return true;
} }
} }
@ -660,6 +661,13 @@ static client_queue_entry_t *create_client_node(client_t *client)
return node; return node;
} }
static void free_client_node(client_queue_entry_t *node)
{
free(node->shoutcast_mount);
free(node->bodybuffer);
free(node);
}
void connection_queue(connection_t *con) void connection_queue(connection_t *con)
{ {
client_queue_entry_t *node; client_queue_entry_t *node;
@ -848,8 +856,7 @@ static void _handle_shoutcast_compatible(client_queue_entry_t *node)
if (ptr == NULL){ if (ptr == NULL){
client_destroy(client); client_destroy(client);
free(node->shoutcast_mount); free_client_node(node);
free(node);
return; return;
} }
*ptr = '\0'; *ptr = '\0';
@ -895,8 +902,7 @@ static void _handle_shoutcast_compatible(client_queue_entry_t *node)
client_destroy(client); client_destroy(client);
} }
free(http_compliant); free(http_compliant);
free(node->shoutcast_mount); free_client_node(node);
free(node);
return; return;
} }
@ -993,9 +999,7 @@ static void _handle_connection(void)
if (node->shoutcast_mount && strcmp (rawuri, "/admin.cgi") == 0) if (node->shoutcast_mount && strcmp (rawuri, "/admin.cgi") == 0)
httpp_set_query_param (client->parser, "mount", node->shoutcast_mount); httpp_set_query_param (client->parser, "mount", node->shoutcast_mount);
free (node->bodybuffer); free_client_node(node);
free (node->shoutcast_mount);
free (node);
connection_handle_client(client); connection_handle_client(client);
} else { } else {