if ((p = (struct map2id_s *)malloc(sizeof(*p))) == NULL) {
novm("rc_read_mapfile");
+ fclose(mapfd);
return (-1);
}
- p->name = strdup(name);
+ if ((p->name = strdup(name)) == NULL) {
+ novm("rc_read_mapfile");
+ fclose(mapfd);
+ return (-1);
+ }
p->id = atoi(id);
p->next = map2id_list;
map2id_list = p;
} else {
error("rc_read_mapfile: malformed line in %s, line %d", filename, lnr);
+ fclose(mapfd);
return (-1);
}