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.
This commit is contained in:
parent
d4ae33f072
commit
3a3dd1fd20
@ -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 @@ add_file(int percent, const char *file, const char *dir, FILEDESC **head,
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user