fix freeing order when generating error messages. found by Dmitry V. Krivenok
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Tue, 11 Aug 2009 14:00:57 +0000 (14:00 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Tue, 11 Aug 2009 14:00:57 +0000 (14:00 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1889 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_restore.c

index 4cbc37a..46a79b5 100644 (file)
@@ -294,13 +294,14 @@ static int get_xml_double(
         }        
         errno = 0;
         temp = strtod((char *)text,NULL);
         }        
         errno = 0;
         temp = strtod((char *)text,NULL);
-        xmlFree(text);        
         if (errno>0){
             rrd_set_error("ling %d: get_xml_double from '%s' %s",
                           xmlTextReaderGetParserLineNumber(reader),
                           text,rrd_strerror(errno));
         if (errno>0){
             rrd_set_error("ling %d: get_xml_double from '%s' %s",
                           xmlTextReaderGetParserLineNumber(reader),
                           text,rrd_strerror(errno));
+            xmlFree(text);        
             return -1;
         }
             return -1;
         }
+        xmlFree(text);        
         *value = temp;
         return 0;
     }
         *value = temp;
         return 0;
     }