Bugfix einleseroutine, zu wenig speicher allokiert.

This commit is contained in:
Enno Rehling 2002-03-31 13:22:48 +00:00
parent 2f447ac0e4
commit 8a8b35e82e
1 changed files with 6 additions and 6 deletions

View File

@ -386,17 +386,17 @@ tagbegin(struct xml_stack * stack)
}
} else if (strcmp(tag->name, "maintenance")==0) {
size_t len = 0;
const resource_type * rtype;
maintenance * mt;
const resource_type * rtype = NULL;
maintenance * mt = bt->maintenance;
resource_t type = NORESOURCE;
if (bt->maintenance==NULL) {
mt = bt->maintenance = calloc(sizeof(maintenance), 2);
if (mt==NULL) {
mt = bt->maintenance = calloc(sizeof(struct maintenance), 2);
len = 0;
} else {
mt = bt->maintenance;
while (mt[len].number) ++len;
mt = realloc(mt, sizeof(maintenance)*(len+1));
mt = bt->maintenance = realloc(mt, sizeof(struct maintenance)*(len+2));
}
fprintf(stderr, "maintenance %s %d %u\n", bt->_name, len, sizeof(maintenance));
mt[len+1].number = 0;
mt[len].number = xml_ivalue(tag, "amount");
rtype = rt_find(xml_value(tag, "type"));