bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tests: fix memory leak


From: Akim Demaille
Subject: tests: fix memory leak
Date: Tue, 18 Sep 2018 17:20:20 +0200

ASAN is working, and giving us information about some leaky tests.
There remains a failure, which requires more investigation.

commit 8da0cef821c10d27ec1966b162cebbcba45ef6de
Author: Akim Demaille <address@hidden>
Date:   Mon Sep 17 20:14:24 2018 +0200

    tests: fix memory leak
    
    This was reported by ASAN on the CI.
    
    * tests/types.at (api.value.type): Don't set a semantic value to EOF.

diff --git a/tests/types.at b/tests/types.at
index 5c56a1c0..c17e852f 100644
--- a/tests/types.at
+++ b/tests/types.at
@@ -180,9 +180,13 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], 
[glr.cc]],
              free ($<up>2);
            }],
           ["12"],
-          [AT_VAL.up = (struct u *) malloc (sizeof *AT_VAL.up);
-           assert (AT_VAL.up);
-           AT_VAL.up->ival = res - '0';],
+          [if (res)
+             {
+               AT_VAL.up = (struct u *) malloc (sizeof *AT_VAL.up);
+               assert (AT_VAL.up);
+               AT_VAL.up->ival = res - '0';
+             }
+          ],
           [1 2])
 
   # A user defined union.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]