thermferm/rdconfig.c

changeset 161
493e39bb0a08
parent 158
f1b7e2ef90be
child 162
6fc9e3f7962f
--- a/thermferm/rdconfig.c	Thu Jul 31 17:52:41 2014 +0200
+++ b/thermferm/rdconfig.c	Thu Jul 31 19:29:54 2014 +0200
@@ -47,6 +47,7 @@
     units_list		*tmp2;
     profiles_list	*tmp3;
     prof_step		*tmp4;
+    devices_list	*device;
 
     if (Config.name)
 	free(Config.name);
@@ -103,6 +104,19 @@
     }
     Config.profiles = NULL;
 
+    for (device = Config.devices; device; device = device->next) {
+	if (device->uuid)
+	    free(device->uuid);
+	if (device->address)
+	    free(device->address);
+	if (device->description)
+	    free(device->description);
+	if (device->comment)
+	    free(device->comment);
+	free(device);
+    }
+    Config.devices = NULL;
+
 #ifdef HAVE_WIRINGPI_H
     Config.lcd_cols = 16;
     Config.lcd_rows = 2;
@@ -1156,7 +1170,7 @@
 		device->gpiopin = ival;
 	    xmlFree(key);                                       
 	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESCRPTION"))) {
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESCRIPTION"))) {
 	    device->description = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"INUSE"))) {

mercurial