svn commit: r259056 - head/games/fortune/fortune

Marcel Moolenaar marcel at FreeBSD.org
Sat Dec 7 01:35:19 UTC 2013


Author: marcel
Date: Sat Dec  7 01:35:18 2013
New Revision: 259056
URL: http://svnweb.freebsd.org/changeset/base/259056

Log:
  Fix r203922 for "fortune -o": we free tpath when was_malloc is true
  but don't define tpath everytime we set was_malloc to true. We end
  up calling free() multiple times for the same pointer, resulting in:
  <jemalloc>: jemalloc_arena.c:355: Failed assertion: ...
  When we set path to offensive, we need to set tpath as well.

Modified:
  head/games/fortune/fortune/fortune.c

Modified: head/games/fortune/fortune/fortune.c
==============================================================================
--- head/games/fortune/fortune/fortune.c	Sat Dec  7 00:33:10 2013	(r259055)
+++ head/games/fortune/fortune/fortune.c	Sat Dec  7 01:35:18 2013	(r259056)
@@ -486,7 +486,7 @@ add_file(int percent, const char *file, 
 		if (Offend) {
 			if (was_malloc)
 				free(tpath);
-			path = offensive;
+			path = tpath = offensive;
 			offensive = NULL;
 			was_malloc = TRUE;
 			DPRINTF(1, (stderr, "\ttrying \"%s\"\n", path));
@@ -508,7 +508,7 @@ over:
 		if (All_forts && offensive != NULL) {
 			if (was_malloc)
 				free(tpath);
-			path = offensive;
+			path = tpath = offensive;
 			offensive = NULL;
 			was_malloc = TRUE;
 			DPRINTF(1, (stderr, "\ttrying \"%s\"\n", path));


More information about the svn-src-head mailing list