From 6b5bbb71d02bc6a8256adf947698055054d0ff8e Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 28 Mar 2015 19:47:20 +0100 Subject: [PATCH] rawfile.c, bug fix, missing memory allocation and a memory leak --- src/frontend/rawfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/rawfile.c b/src/frontend/rawfile.c index dafecc5ed..8874a0b4b 100644 --- a/src/frontend/rawfile.c +++ b/src/frontend/rawfile.c @@ -488,7 +488,7 @@ raw_read(char *name) { } else { fprintf(cp_err, "Error: bad var line %s\n", buf); /* MW. v_name must be valid in the case that no. points = 0 */ - v->v_name = "no vars\n"; + v->v_name = copy("no vars\n"); } t = gettok(&s); /* The type name. */ if (t) @@ -498,8 +498,10 @@ raw_read(char *name) { /* Fix the name... */ if (isdigit(*v->v_name) && (r = ft_typabbrev(v ->v_type)) != NULL) { + char *x = v->v_name; (void) sprintf(buf2, "%s(%s)", r, v->v_name); v->v_name = copy(buf2); + tfree(x); } /* Now come the strange options... */