X-Git-Url: https://git.toastfreeware.priv.at/gregoa/bti.git/blobdiff_plain/56d5a4d12e46d3ad1b595ebf9e8dddf6f05f2ee4..bfe6897366a85b1d76be9528e41b5ee8bb3a570c:/bti.c diff --git a/bti.c b/bti.c index db9cadc..6f77ddc 100644 --- a/bti.c +++ b/bti.c @@ -100,8 +100,10 @@ static char *get_string(const char *name) exit(1); if (name != NULL) fprintf(stdout, "%s", name); - if (!fgets(string, 999, stdin)) + if (!fgets(string, 999, stdin)) { + free(string); return NULL; + } temp = strchr(string, '\n'); if (temp) *temp = '\0'; @@ -835,8 +837,10 @@ static char *get_string_from_stdin(void) if (!string) return NULL; - if (!fgets(string, 999, stdin)) + if (!fgets(string, 999, stdin)) { + free(string); return NULL; + } temp = strchr(string, '\n'); if (temp) *temp = '\0';