From 57dbe2344c4cbe5777b499a17a2e15da1cb1a299 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 14 Aug 2016 10:21:11 -0300 Subject: [PATCH] eeshow/sch-parse.c (parse_field): fix small memory leak --- eeshow/sch-parse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eeshow/sch-parse.c b/eeshow/sch-parse.c index 15a10cd..03d3c57 100644 --- a/eeshow/sch-parse.c +++ b/eeshow/sch-parse.c @@ -102,6 +102,7 @@ static bool parse_field(struct sch_ctx *ctx, const char *line) field = alloc_type(struct comp_field); txt = &field->txt; + txt->s = NULL; if (sscanf(line, "F %d \"\" %c %d %d %u %u %c %c%c%c", &n, &hv, &txt->x, &txt->y, &txt->size, &flags, &hor, &vert, @@ -115,6 +116,7 @@ static bool parse_field(struct sch_ctx *ctx, const char *line) return 0; if (flags || (comp->comp && !lib_field_visible(comp->comp, n))) { + free((char *) txt->s); free(field); return 1; }