Download raw body.
Diff memory leak
Omar Polo <op@omarpolo.com> wrote: > On 2024/05/31 10:08:52 +0200, Stefan Sperling <stsp@stsp.name> wrote: > > On Mon, May 27, 2024 at 11:58:02PM -0500, Kyle Ackerman wrote: > > > Hello all, > > > > > > There is a memory leak within `got diff` that leaks line metadata. > > > > > > ******** Start dump got ******* > > > M=8 I=1 F=1 U=1 J=2 R=0 X=0 C=0x449af07a cache=0 G=4096 > > > Leak report: > > > f sum # avg > > > 0xd551a917735 512 1 512 addr2line -e /home/kyle/bin/got 0x4e735 > > > 0xd57f17f70b0 64 1 64 addr2line -e /usr/lib/libc.so.100.1 0xa40b0 > > > 0xd57f182c4d1 112 7 16 addr2line -e /usr/lib/libc.so.100.1 0xd94d1 > > > 0xd57f18158d2 1024 1 1024 addr2line -e /usr/lib/libc.so.100.1 0xc28d2 > > > 0xd57f17aec53 69632 1 69632 addr2line -e /usr/lib/libc.so.100.1 0x5bc53 > > > > > > ******** End dump got ******* > > > > Could you please show what these addr2line commands are printing? > > and also what command line and in what state the repo was when you ran > the command. I forgot to mention how I reproduced Kyle's leak report in my previous mail; with `got diff :base:- :base` addr2line reports lib/diffreg.c:309: p = reallocarray(*lines, *nlines + len, sizeof(**lines)); > > I'm not able to reproduce these, all I see playing with `got diff' are > "leaks" from setlocale() and a missing free(cwd) (also in other cmds). ok for me! > diff /home/op/w/got > commit - c2f5b3e63df878c687928a616ef24e87131a795e > path + /home/op/w/got > blob - b32ea7c37a6e4abe3ed85220602e1e8e24af6dc0 > file + got/got.c > --- got/got.c > +++ got/got.c > @@ -5629,6 +5629,7 @@ cmd_diff(int argc, char *argv[]) > error = printfile(outfile); > > done: > + free(cwd); > free(labels[0]); > free(labels[1]); > free(ids[0]); > @@ -13794,6 +13795,7 @@ cmd_merge(int argc, char *argv[]) > > } > done: > + free(cwd); > free(gitconfig_path); > free(id_str); > free(merge_commit_id); > @@ -14447,6 +14449,7 @@ cmd_cat(int argc, char *argv[]) > id = NULL; > } > done: > + free(cwd); > free(label); > free(id); > free(commit_id); -- Mark Jamsek <https://bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
Diff memory leak