]> ToastFreeware Gitweb - gregoa/bti.git/blobdiff - bti.c
HACKING: this is bti, not smugbatch
[gregoa/bti.git] / bti.c
diff --git a/bti.c b/bti.c
index db9cadc8043f1cd5e23c539a077770d760a5086f..6f77ddc669672d1d976f28630b6d8c01187dc5e1 100644 (file)
--- 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';