[gq-commit] gq/src xmlparse.c,1.4,1.5
Status: Beta
Brought to you by:
sur5r
From: <sta...@us...> - 2003-10-05 22:19:17
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv7216 Modified Files: xmlparse.c Log Message: * Fixed a bug that caused NULL's to be stored where there used to be allocated buffers, thus causing SIGSEGVs * Do not crash if the file to be parsed cannot be opened Index: xmlparse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/xmlparse.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** xmlparse.c 5 Oct 2003 13:53:02 -0000 1.4 --- xmlparse.c 5 Oct 2003 22:19:09 -0000 1.5 *************** *** 47,50 **** --- 47,51 ---- #include <string.h> + #include <errno.h> /* This is the only part specific to GTK, I hope */ *************** *** 101,104 **** --- 102,107 ---- stack->entries[stack->sp++] = e; e->tag = strdup(tag); + e->cdata = strdup(""); + e->len = 1; return e; *************** *** 348,356 **** xmlFreeParserCtxt(parser); } else { ! XMLhandleFatalError(&ctx, "Cannot open file"); rc = -1; } ! fclose(fp); /* inputCloseCallbackDummy does not close fp. That way ! we can be sure that fp gets closed only once. */ #else rc = xmlSAXUserParseFile(handler, &ctx, file); --- 351,360 ---- xmlFreeParserCtxt(parser); } else { ! XMLhandleFatalError(&ctx, "Cannot open file '%s': %s", ! file, strerror(errno)); rc = -1; } ! if (fp) fclose(fp); /* inputCloseCallbackDummy does not close fp. That way ! we can be sure that fp gets closed only once. */ #else rc = xmlSAXUserParseFile(handler, &ctx, file); |