commit 0dc7faa9e43711899b05ff94aa85278352daf2fc from: Stefan Sperling date: Sun Aug 09 20:33:12 2020 UTC fix double-free when quitting tog's diff view; found by ofree at /home/stsp/src/got/tog/tog.c:3415 3415 free(s->line_offsets); (gdb) bt msg=0x80e2a4cd87e "chunk is already free %p") at /usr/src/lib/libc/stdlib/malloc.c:300 check=1) at /usr/src/lib/libc/stdlib/malloc.c:1070 clear=0, check=, argsz=0) at /usr/src/lib/libc/stdlib/malloc.c:1431 at /usr/src/lib/libc/stdlib/malloc.c:1488 at /home/stsp/src/got/tog/tog.c:3415 at /home/stsp/src/got/tog/tog.c:518 at /home/stsp/src/got/tog/tog.c:954 at /home/stsp/src/got/tog/tog.c:2728 at /home/stsp/src/got/tog/tog.c:5683 (gdb) commit - 369eef86a8da74dcb95f04df3a266d9b8c8d2d9b commit + 0dc7faa9e43711899b05ff94aa85278352daf2fc blob - 3ba1e4310ede9eee49ceb0718c034dac3fe71cd8 blob + c75199bcfe9fdfd12312dee4c08c99308cc28645 --- tog/tog.c +++ tog/tog.c @@ -3103,6 +3103,7 @@ get_filestream_info(size_t *filesize, int *nlines, off if (fflush(infile) != 0) { free(buf); free(*line_offsets); + *line_offsets = NULL; return got_error_from_errno("fflush"); } rewind(infile); @@ -3112,6 +3113,7 @@ get_filestream_info(size_t *filesize, int *nlines, off free(buf); free(*line_offsets); + *line_offsets = NULL; return NULL; }