[rrd-developers] rrd_restore.c fix (for version 1.2.11)
Eric ZYLBERSTEJN
ezylby at yahoo.fr
Mon Nov 21 20:45:58 MET 2005
Hi,
Before :
501 {"range-check", required_argument, 0,
'r'},
502 {"force-overwrite", required_argument,
0, 'f'},
509 opt = getopt_long(argc, argv, "r:f",
long_options, option_index);
After :
501 {"range-check", no_argument, 0,
'r'},
502 {"force-overwrite", no_argument, 0,
'f'},
509 opt = getopt_long(argc, argv, "rf",
long_options, option_index);
Explanation :
With --force-overwrite or --range-check specified,
getopt_long() eats up the next argument and things get
messed up : readfile() tries to read the rrd file
instead of the xml.
Note 1 : short options -f or -r work properly with the
current code.
Note 2 : this fix hides the "double free" problem but
doesn't solve it.
It is caused by xml2rrd() freeing rrd -> stat_head
when something goes wrong, and not resetting it to
NULL.
Then rrd_restore() tries to free the whole rrd
structure :
531 if (xml2rrd(buf,&rrd,rc)==-1) {
532 rrd_free(&rrd);
533 free(buf);
534 return -1;
535 }
void rrd_free(rrd_t *rrd)
{
if (rrd->stat_head) free(rrd->stat_head);
...
}
I guess these free(rrd -> stat_head); instructions in
xml2rrd() can be removed.
Eric
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://lists.ee.ethz.ch/rrd-developers
WebAdmin http://lists.ee.ethz.ch/lsg2.cgi
More information about the rrd-developers
mailing list