mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
Plug several small memory leak, and one huge one in the xslt output code
svn path=/trunk/icecast/; revision=4174
This commit is contained in:
parent
b8a686018f
commit
d218eedf9a
@ -86,6 +86,8 @@ void config_shutdown(void)
|
|||||||
if (c->error_log && c->error_log != CONFIG_DEFAULT_ERROR_LOG)
|
if (c->error_log && c->error_log != CONFIG_DEFAULT_ERROR_LOG)
|
||||||
xmlFree(c->error_log);
|
xmlFree(c->error_log);
|
||||||
if (c->bind_address) xmlFree(c->bind_address);
|
if (c->bind_address) xmlFree(c->bind_address);
|
||||||
|
if (c->master_server) xmlFree(c->master_server);
|
||||||
|
if (c->master_password) xmlFree(c->master_password);
|
||||||
if (c->user) xmlFree(c->user);
|
if (c->user) xmlFree(c->user);
|
||||||
if (c->group) xmlFree(c->group);
|
if (c->group) xmlFree(c->group);
|
||||||
dirnode = _configuration.dir_list;
|
dirnode = _configuration.dir_list;
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "xslt.h"
|
#include "xslt.h"
|
||||||
#include "fserve.h"
|
#include "fserve.h"
|
||||||
|
|
||||||
|
#include <libxml/xmlmemory.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
@ -80,6 +82,8 @@ static void _shutdown_subsystems(void)
|
|||||||
sock_shutdown();
|
sock_shutdown();
|
||||||
thread_shutdown();
|
thread_shutdown();
|
||||||
log_shutdown();
|
log_shutdown();
|
||||||
|
|
||||||
|
xmlCleanupParser();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _parse_config_file(int argc, char **argv, char *filename, int size)
|
static int _parse_config_file(int argc, char **argv, char *filename, int size)
|
||||||
|
@ -102,6 +102,7 @@ static void *_slave_thread(void *arg) {
|
|||||||
strcat(authheader, password);
|
strcat(authheader, password);
|
||||||
data = util_base64_encode(authheader);
|
data = util_base64_encode(authheader);
|
||||||
sock_write(mastersock, "GET /allstreams.txt HTTP/1.0\r\nAuthorization: Basic %s\r\n\r\n", data);
|
sock_write(mastersock, "GET /allstreams.txt HTTP/1.0\r\nAuthorization: Basic %s\r\n\r\n", data);
|
||||||
|
free(authheader);
|
||||||
free(data);
|
free(data);
|
||||||
while (sock_read_line(mastersock, buf, sizeof(buf))) {
|
while (sock_read_line(mastersock, buf, sizeof(buf))) {
|
||||||
if(!strlen(buf))
|
if(!strlen(buf))
|
||||||
|
20
src/stats.c
20
src/stats.c
@ -84,6 +84,7 @@ void stats_initialize()
|
|||||||
void stats_shutdown()
|
void stats_shutdown()
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
stats_event_t *event, *next;
|
||||||
|
|
||||||
if(!_stats_running) /* We can't shutdown if we're not running. */
|
if(!_stats_running) /* We can't shutdown if we're not running. */
|
||||||
return;
|
return;
|
||||||
@ -110,6 +111,17 @@ void stats_shutdown()
|
|||||||
thread_mutex_destroy(&_stats_mutex);
|
thread_mutex_destroy(&_stats_mutex);
|
||||||
avl_tree_free(_stats.source_tree, _free_source_stats);
|
avl_tree_free(_stats.source_tree, _free_source_stats);
|
||||||
avl_tree_free(_stats.global_tree, _free_stats);
|
avl_tree_free(_stats.global_tree, _free_stats);
|
||||||
|
|
||||||
|
event = _global_event_queue;
|
||||||
|
while(event) {
|
||||||
|
if(event->source)
|
||||||
|
free(event->source);
|
||||||
|
if(event->value)
|
||||||
|
free(event->value);
|
||||||
|
next = event->next;
|
||||||
|
free(event);
|
||||||
|
event = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stats_t *stats_get_stats()
|
stats_t *stats_get_stats()
|
||||||
@ -746,6 +758,7 @@ void stats_get_xml(xmlDocPtr *doc)
|
|||||||
stats_event_t *queue;
|
stats_event_t *queue;
|
||||||
xmlNodePtr node, srcnode;
|
xmlNodePtr node, srcnode;
|
||||||
source_xml_t *src_nodes = NULL;
|
source_xml_t *src_nodes = NULL;
|
||||||
|
source_xml_t *next;
|
||||||
|
|
||||||
queue = NULL;
|
queue = NULL;
|
||||||
_dump_stats_to_queue(&queue);
|
_dump_stats_to_queue(&queue);
|
||||||
@ -767,6 +780,13 @@ void stats_get_xml(xmlDocPtr *doc)
|
|||||||
_free_event(event);
|
_free_event(event);
|
||||||
event = _get_event_from_queue(&queue);
|
event = _get_event_from_queue(&queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (src_nodes) {
|
||||||
|
next = src_nodes->next;
|
||||||
|
free(src_nodes->mount);
|
||||||
|
free(src_nodes);
|
||||||
|
src_nodes = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void stats_sendxml(client_t *client)
|
void stats_sendxml(client_t *client)
|
||||||
{
|
{
|
||||||
|
@ -169,8 +169,7 @@ void xslt_transform(xmlDocPtr doc, char *xslfilename, client_t *client)
|
|||||||
(char *)outputBuffer->buffer->content))
|
(char *)outputBuffer->buffer->content))
|
||||||
client->con->sent_bytes += bytes;
|
client->con->sent_bytes += bytes;
|
||||||
|
|
||||||
|
xmlOutputBufferClose(outputBuffer);
|
||||||
xmlFree(outputBuffer);
|
|
||||||
xmlFreeDoc(res);
|
xmlFreeDoc(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user