Fix some nasty memory errors.

Three cheers for valgrind!!!
This commit is contained in:
Bill Currie 2012-11-01 20:32:25 +09:00
parent 5c79953a7e
commit ea34a5b753
2 changed files with 2 additions and 3 deletions

View File

@ -72,7 +72,7 @@ method_get_key (const void *meth, void *unused)
static void static void
method_free (void *_meth, void *unused) method_free (void *_meth, void *unused)
{ {
method_t *meth = (method_t *) meth; method_t *meth = (method_t *) _meth;
free (meth->name); free (meth->name);
free (meth->types); free (meth->types);

View File

@ -484,8 +484,7 @@ separate_compile (void)
temp_files[i++] = save_string (output_file->str); temp_files[i++] = save_string (output_file->str);
err = compile_to_obj (*file, output_file->str, lang) || err; err = compile_to_obj (*file, output_file->str, lang) || err;
free ((char *)*file); *file = save_string (output_file->str);
*file = strdup (output_file->str);
} else { } else {
if (options.compile) if (options.compile)
fprintf (stderr, "%s: %s: ignoring object file since linking " fprintf (stderr, "%s: %s: ignoring object file since linking "