summaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2013-12-07 01:35:18 +0000
committermarcel <marcel@FreeBSD.org>2013-12-07 01:35:18 +0000
commitfbd9d78c47bb221eac61fa51d6b53ac4b5b24569 (patch)
tree59273df37462868d939efaf2c1f69152fbd40df9 /games
parentea67b8239d4b9fc5ec66acb0b55c08b6724c220c (diff)
downloadFreeBSD-src-fbd9d78c47bb221eac61fa51d6b53ac4b5b24569.zip
FreeBSD-src-fbd9d78c47bb221eac61fa51d6b53ac4b5b24569.tar.gz
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.
Diffstat (limited to 'games')
-rw-r--r--games/fortune/fortune/fortune.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c
index d5ce1b9..4b2ffa7 100644
--- a/games/fortune/fortune/fortune.c
+++ b/games/fortune/fortune/fortune.c
@@ -486,7 +486,7 @@ add_file(int percent, const char *file, const char *dir, FILEDESC **head,
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));
OpenPOWER on IntegriCloud