diff options
| author | Zach DeCook <zachdecook@librem.one> | 2022-01-22 04:50:55 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2022-01-22 04:50:55 -0500 |
| commit | d04f7e07d4a5278e8e8530925e2852b591d6e37b (patch) | |
| tree | 1821a1b73a48a507357560fe36af242fb48208b4 /main.c | |
| parent | da3ce831fdeed71dd2a0e3deb977d6bc770ef2f9 (diff) | |
| download | suggpicker-d04f7e07d4a5278e8e8530925e2852b591d6e37b.tar.gz | |
input: fix obvious memory leak
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main.c b/main.c index 5ffb772..c7d04ec 100644 --- a/main.c +++ b/main.c @@ -391,7 +391,7 @@ handle_input(FILE *fd, struct key *sugg) { char *l = line; for (i = 0; l[i+1]; i++) { if (l[i] == '\t') { - // free label? + free(key->label); key->label = strndup(l,i); l += i + 1; i = 0; @@ -400,8 +400,10 @@ handle_input(FILE *fd, struct key *sugg) { break; } } + free(key->label); key->label = strndup(l,i); - key+=sizeof(struct key*); + key++; + free(key->label); key->label = NULL; } |
