From ea34a5b753c34cc9a943795a6ca77754ba4d6fc7 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 1 Nov 2012 20:32:25 +0900 Subject: [PATCH] Fix some nasty memory errors. Three cheers for valgrind!!! --- tools/qfcc/source/method.c | 2 +- tools/qfcc/source/qfcc.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/qfcc/source/method.c b/tools/qfcc/source/method.c index 734788bc9..17addf3db 100644 --- a/tools/qfcc/source/method.c +++ b/tools/qfcc/source/method.c @@ -72,7 +72,7 @@ method_get_key (const void *meth, void *unused) static void method_free (void *_meth, void *unused) { - method_t *meth = (method_t *) meth; + method_t *meth = (method_t *) _meth; free (meth->name); free (meth->types); diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c index 42f1dbf99..5aee48384 100644 --- a/tools/qfcc/source/qfcc.c +++ b/tools/qfcc/source/qfcc.c @@ -484,8 +484,7 @@ separate_compile (void) temp_files[i++] = save_string (output_file->str); err = compile_to_obj (*file, output_file->str, lang) || err; - free ((char *)*file); - *file = strdup (output_file->str); + *file = save_string (output_file->str); } else { if (options.compile) fprintf (stderr, "%s: %s: ignoring object file since linking "