1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 13:04:15 +02:00

eeshow/lib-parse.c (parse_def): don't break free'ing the component name

This commit is contained in:
Werner Almesberger 2016-08-07 16:03:13 -03:00
parent 9c988e2d7e
commit 3b8b8a20d2

View File

@ -69,8 +69,14 @@ static bool parse_def(struct lib *lib, const char *line)
return 0;
lib->curr_comp = alloc_type(struct comp);
if (*s == '~')
s++;
if (*s == '~') {
char *tmp = alloc_size(strlen(s) + 1);
/* we can't just s++, since that would break freeing */
strcpy(tmp, s + 1);
free(s);
s = tmp;
}
lib->curr_comp->name = s;
lib->curr_comp->units = units;