[xiph-commits] r8609 - icecast/trunk/ices/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Tue Jan 4 09:35:26 PST 2005


Author: karl
Date: 2005-01-04 09:35:26 -0800 (Tue, 04 Jan 2005)
New Revision: 8609

Modified:
   icecast/trunk/ices/src/cfgparse.c
   icecast/trunk/ices/src/ices.c
Log:
fix some memory issues, these don't show in normal cases


Modified: icecast/trunk/ices/src/cfgparse.c
===================================================================
--- icecast/trunk/ices/src/cfgparse.c	2005-01-04 09:27:33 UTC (rev 8608)
+++ icecast/trunk/ices/src/cfgparse.c	2005-01-04 17:35:26 UTC (rev 8609)
@@ -109,10 +109,10 @@
 
 void config_free_instance(instance_t *instance)
 {
-    if (instance->hostname) free(instance->hostname);
-    if (instance->password) free(instance->password);
-    if (instance->user) free(instance->user);
-    if (instance->mount) free(instance->mount);
+    if (instance->hostname) xmlFree(instance->hostname);
+    if (instance->password) xmlFree(instance->password);
+    if (instance->user) xmlFree(instance->user);
+    if (instance->mount) xmlFree(instance->mount);
     if (instance->queue) 
     {
         thread_mutex_destroy(&instance->queue->lock);
@@ -122,11 +122,11 @@
 
 static void _set_instance_defaults(instance_t *instance)
 {
-    instance->hostname = strdup(DEFAULT_HOSTNAME);
+    instance->hostname = xmlStrdup(DEFAULT_HOSTNAME);
     instance->port = DEFAULT_PORT;
-    instance->password = strdup(DEFAULT_PASSWORD);
+    instance->password = xmlStrdup(DEFAULT_PASSWORD);
     instance->user = DEFAULT_USERNAME;
-    instance->mount = strdup(DEFAULT_MOUNT);
+    instance->mount = xmlStrdup(DEFAULT_MOUNT);
     instance->managed = DEFAULT_MANAGED;
     instance->min_br = DEFAULT_MIN_BITRATE;
     instance->nom_br = DEFAULT_NOM_BITRATE;
@@ -366,18 +366,18 @@
     instance_t *instance;
 
     c->background = DEFAULT_BACKGROUND;
-    c->logpath = strdup(DEFAULT_LOGPATH);
-    c->logfile = strdup(DEFAULT_LOGFILE);
+    c->logpath = xmlStrdup(DEFAULT_LOGPATH);
+    c->logfile = xmlStrdup(DEFAULT_LOGFILE);
     c->logsize = DEFAULT_LOGSIZE;
     c->loglevel = DEFAULT_LOGLEVEL;
     c->log_stderr = DEFAULT_LOG_STDERR;
 
-    c->stream_name = strdup(DEFAULT_STREAM_NAME);
-    c->stream_genre = strdup(DEFAULT_STREAM_GENRE);
-    c->stream_description = strdup(DEFAULT_STREAM_DESCRIPTION);
+    c->stream_name = xmlStrdup(DEFAULT_STREAM_NAME);
+    c->stream_genre = xmlStrdup(DEFAULT_STREAM_GENRE);
+    c->stream_description = xmlStrdup(DEFAULT_STREAM_DESCRIPTION);
     c->stream_url = NULL;
 
-    c->playlist_module = strdup(DEFAULT_PLAYLIST_MODULE);
+    c->playlist_module = xmlStrdup(DEFAULT_PLAYLIST_MODULE);
     
     c->module_params = NULL;
 
@@ -404,9 +404,9 @@
 void config_initialize(void)
 {
     ices_config = (config_t *)calloc(1, sizeof(config_t));
+    xmlInitParser();
     _set_defaults(ices_config);
     srand(time(NULL));
-    xmlInitParser();
 }
 
 void config_shutdown(void)

Modified: icecast/trunk/ices/src/ices.c
===================================================================
--- icecast/trunk/ices/src/ices.c	2005-01-04 09:27:33 UTC (rev 8608)
+++ icecast/trunk/ices/src/ices.c	2005-01-04 17:35:26 UTC (rev 8609)
@@ -19,6 +19,9 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <libxml/parser.h>
+#include <libxml/xmlmemory.h>
+
 #include <thread/thread.h>
 
 #include "cfgparse.h"



More information about the commits mailing list