From: Mark Jamsek Subject: plug line_offsets leak in tog blame To: gameoftrees@openbsd.org Date: Fri, 11 Aug 2023 20:30:52 +1000 As per the subject, we are leaking the blamed file's line_offsets allocated from run_blame()'s call to got_object_blob_dump_to_file(). We need to free them from stop_blame() and not close_blame_view() because we reload the blame view without closing it (e.g., cCp keymaps) and only call stop_blame() in such cases. diff 2e76d8a7c48df35fbab843656f1c604c999ed71f 24ddc342dc6398b32e9ce3d5cbcdc2b331228747 commit - 2e76d8a7c48df35fbab843656f1c604c999ed71f commit + 24ddc342dc6398b32e9ce3d5cbcdc2b331228747 blob - c4839d1c9023a068753142f189620d39826b0968 blob + d0f674078d9fb63ad070889a2c85507fd302daf3 --- tog/tog.c +++ tog/tog.c @@ -6590,6 +6590,8 @@ stop_blame(struct tog_blame *blame) err = pack_err; blame->pack_fds = NULL; } + free(blame->line_offsets); + blame->line_offsets = NULL; return err; } -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68