]> granicus.if.org Git - flex/commitdiff
fix possible resource leak with yynultrans_tbl
authorJaska Uimonen <jaska.uimonen@helsinki.fi>
Mon, 27 Jul 2015 08:20:05 +0000 (11:20 +0300)
committerWill Estes <westes575@gmail.com>
Thu, 6 Aug 2015 13:28:21 +0000 (09:28 -0400)
src/gen.c

index 049cbfe25c7f859e762d9cbd69b1969b2ea5a3bf..81e7c274c83465bc2c912ef58d9df7e336600bfa 100644 (file)
--- a/src/gen.c
+++ b/src/gen.c
@@ -1525,7 +1525,7 @@ void make_tables (void)
 {
        int i;
        int did_eof_rule = false;
-       struct yytbl_data *yynultrans_tbl;
+       struct yytbl_data *yynultrans_tbl = NULL;
 
 
        skelout ();             /* %% [2.0] - break point in skel */
@@ -1755,9 +1755,13 @@ void make_tables (void)
                            0)
                                flexerror (_
                                           ("Could not write yynultrans_tbl"));
+               }
+
+               if (yynultrans_tbl != NULL) {
                        yytbl_data_destroy (yynultrans_tbl);
                        yynultrans_tbl = NULL;
-               }
+        }
+
                /* End generating yy_NUL_trans */
        }