jshn: main: fix leak of memory pointed to by 'vars'
authorPetr Štetiar <ynezz@true.cz>
Tue, 19 Nov 2019 11:34:14 +0000 (12:34 +0100)
committerPetr Štetiar <ynezz@true.cz>
Sun, 24 Nov 2019 12:26:58 +0000 (13:26 +0100)
Fixes following leak of memory:

 6,016 bytes in 1 blocks are possibly lost in loss record 1 of 1
    at 0x4C31B25: calloc
    by 0x1098F8: main (jshn.c:353)

Signed-off-by: Petr Štetiar <ynezz@true.cz>
jshn.c

diff --git a/jshn.c b/jshn.c
index 1efe2548b74b9f57b5eb401aa5be2369187b3423..2eebe6c3df09520bb7883062b9b90bcf82ed3fb0 100644 (file)
--- a/jshn.c
+++ b/jshn.c
@@ -443,12 +443,15 @@ int main(int argc, char **argv)
                        indent = true;
                        break;
                default:
+                       free(vars);
                        return usage(argv[0]);
                }
        }
 
+       free(vars);
        return usage(argv[0]);
 
 exit:
+       free(vars);
        return ret;
 }