shithub: mc

Download patch

ref: b2ea6be4fd100222817cb2ad5dbb70ddda74ee48
parent: 5c1af81cfb80a3a4dcdb9b4cd8f1597366a0233c
author: Ori Bernstein <[email protected]>
date: Mon Jan 6 19:48:27 EST 2014

Allocate the error strings, to avoid a segfault.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -67,7 +67,7 @@
     idx = NULL;
     switch (n->type) {
         default:
-            s = nodestr(n->type);
+            s = strdup(nodestr(n->type));
             break;
         case Ndecl:
             u = declname(n);
@@ -77,7 +77,7 @@
             free(t);
             break;
         case Nname:
-            s = namestr(n);
+            s = strdup(namestr(n));
             break;
         case Nexpr:
             if (n->expr.idx)