diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2021-03-22 16:44:47 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2021-03-22 16:54:00 +0200 |
commit | a84e72a583c3ea6d261447ec1560bf0d3cb32356 (patch) | |
tree | a771ed88acb675b7e82e01cf90eb9c3800a95134 | |
parent | 8f9af0917131436651449306dbcedcff5dcec2c2 (diff) | |
download | gdbm-a84e72a583c3ea6d261447ec1560bf0d3cb32356.tar.gz |
Fix minor memory leaks in gdbmtool
* src/datconv.c (dsegm_list_free): Free name if necessary.
* src/gram.y (defid): Free $1 when no longer needed.
-rw-r--r-- | src/datconv.c | 2 | ||||
-rw-r--r-- | src/gram.y | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/datconv.c b/src/datconv.c index 7e9e532..ead1e57 100644 --- a/src/datconv.c +++ b/src/datconv.c @@ -206,6 +206,8 @@ dsegm_list_free (struct dsegm *dp) while (dp) { struct dsegm *next = dp->next; + if (dp->type == FDEF_FLD) + free (dp->v.field.name); free (dp); dp = next; } @@ -219,13 +219,20 @@ optcomma : /* empty */ defid : T_IDENT { if (strcmp ($1, "key") == 0) - $$ = DS_KEY; + { + $$ = DS_KEY; + free ($1); + } else if (strcmp ($1, "content") == 0) - $$ = DS_CONTENT; + { + $$ = DS_CONTENT; + free ($1); + } else { terror (_("expected \"key\" or \"content\", " "but found \"%s\""), $1); + free ($1); YYERROR; } } |