Fix two bugs found by valgrind: freeParser() wasn't freeing the outer struct, and the check for

duplicate attribute names was overrunning the existing array.
This commit is contained in:
Laurence Withers 2007-01-08 11:22:35 +00:00
parent c081c94d72
commit 58441639b4
1 changed files with 3 additions and 1 deletions

View File

@ -454,7 +454,7 @@ int csxml_feedChar(struct csxml* ctx, char ch)
default:
if(ch != '=') ERROR("Invalid character in attribute name.");
for(try = 0; (size_t)try < ctx->elemAttrNames.size; ++try) {
for(try = 0; (size_t)try < ctx->elemAttrNames.len; ++try) {
if(!strcmp(ctx->elemAttrNames.data[try].data, ctx->buffer.data))
ERROR("Duplicate attribute in element.");
}
@ -645,6 +645,8 @@ void csxml_freeParser(struct csxml* ctx)
list_free(&ctx->elemStack);
list_free(&ctx->elemAttrNames);
list_free(&ctx->elemAttrVals);
free(ctx);
}