[xiph-cvs] cvs commit: icecast/src config.c main.c slave.c stats.c xslt.c
Michael Smith
msmith at xiph.org
Sun Dec 29 06:06:20 PST 2002
msmith 02/12/29 09:06:20
Modified: src config.c main.c slave.c stats.c xslt.c
Log:
Plug several small memory leak, and one huge one in the xslt output code
Revision Changes Path
1.20 +2 -0 icecast/src/config.c
Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- config.c 18 Aug 2002 05:06:58 -0000 1.19
+++ config.c 29 Dec 2002 14:06:20 -0000 1.20
@@ -86,6 +86,8 @@
if (c->error_log && c->error_log != CONFIG_DEFAULT_ERROR_LOG)
xmlFree(c->error_log);
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->group) xmlFree(c->group);
dirnode = _configuration.dir_list;
<p><p>1.20 +4 -0 icecast/src/main.c
Index: main.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/main.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- main.c 29 Dec 2002 08:10:10 -0000 1.19
+++ main.c 29 Dec 2002 14:06:20 -0000 1.20
@@ -29,6 +29,8 @@
#include "xslt.h"
#include "fserve.h"
+#include <libxml/xmlmemory.h>
+
#ifdef _WIN32
#define snprintf _snprintf
#endif
@@ -80,6 +82,8 @@
sock_shutdown();
thread_shutdown();
log_shutdown();
+
+ xmlCleanupParser();
}
static int _parse_config_file(int argc, char **argv, char *filename, int size)
<p><p>1.8 +1 -0 icecast/src/slave.c
Index: slave.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/slave.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- slave.c 29 Dec 2002 09:21:32 -0000 1.7
+++ slave.c 29 Dec 2002 14:06:20 -0000 1.8
@@ -102,6 +102,7 @@
strcat(authheader, password);
data = util_base64_encode(authheader);
sock_write(mastersock, "GET /allstreams.txt HTTP/1.0\r\nAuthorization: Basic %s\r\n\r\n", data);
+ free(authheader);
free(data);
while (sock_read_line(mastersock, buf, sizeof(buf))) {
if(!strlen(buf))
<p><p>1.21 +20 -0 icecast/src/stats.c
Index: stats.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/stats.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- stats.c 10 Aug 2002 03:22:44 -0000 1.20
+++ stats.c 29 Dec 2002 14:06:20 -0000 1.21
@@ -84,6 +84,7 @@
void stats_shutdown()
{
int n;
+ stats_event_t *event, *next;
if(!_stats_running) /* We can't shutdown if we're not running. */
return;
@@ -110,6 +111,17 @@
thread_mutex_destroy(&_stats_mutex);
avl_tree_free(_stats.source_tree, _free_source_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()
@@ -746,6 +758,7 @@
stats_event_t *queue;
xmlNodePtr node, srcnode;
source_xml_t *src_nodes = NULL;
+ source_xml_t *next;
queue = NULL;
_dump_stats_to_queue(&queue);
@@ -766,6 +779,13 @@
_free_event(event);
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)
<p><p>1.7 +1 -2 icecast/src/xslt.c
Index: xslt.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/xslt.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- xslt.c 29 Dec 2002 09:21:32 -0000 1.6
+++ xslt.c 29 Dec 2002 14:06:20 -0000 1.7
@@ -169,8 +169,7 @@
(char *)outputBuffer->buffer->content))
client->con->sent_bytes += bytes;
-
- xmlFree(outputBuffer);
+ xmlOutputBufferClose(outputBuffer);
xmlFreeDoc(res);
}
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list