Date: Sat, 7 Dec 2013 01:35:19 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259056 - head/games/fortune/fortune Message-ID: <201312070135.rB71ZJbu022506@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312070135.rB71ZJbu022506>