Skip to content

Conversation

@michaelortmann
Copy link
Member

Found by: michaelortmann
Patch by: michaelortmann
Fixes:

One-line summary:
Fix memory leak in filesys.mod

Additional description (if needed):

Test cases demonstrating functionality (if applicable):

CFLAGS="-O0 -g3 -fsanitize=address,undefined" ./configure
...
.files
[22:01:32] tcl: builtin dcc call: *dcc:files -HQ 1 
[22:01:32] #-HQ# files
Entering file system...
*** -HQ has left: file system

Welcome to the BotA file server
All file transfers will be sent to '-HQ' by default.
(You can specify an alternate nick with the 'get' command.)
Type 'help' for help.
Current directory: /

cd incoming/../incoming/
New current directory: /incoming
.quit
*** Ja mata!
Returning you to command mode...
*** -HQ has returned.
.die 
[22:01:39] tcl: builtin dcc call: *dcc:die -HQ 1 
[22:01:39] #-HQ# die 
*** BOT SHUTDOWN (Authorized by -HQ)
[22:01:39] Writing user file...
[22:01:39] Writing channel file...
[22:01:39] * DIE BY -HQ!llama@console (request)

=================================================================
==350636==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x7f5a90920cb5 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:67
    #1 0x55aa428bfaea in n_malloc /home/michael/projects/eggdrop/src/mem.c:341
    #2 0x55aa428d5482 in mod_malloc /home/michael/projects/eggdrop/src/modules.c:1015
    #3 0x7b5a8aeccc19 in resolve_dir .././filesys.mod/files.c:244
    #4 0x7b5a8aecfa1d in cmd_chdir .././filesys.mod/files.c:342
    #5 0x7b5a8af3b2a4 in builtin_fil .././filesys.mod/filesys.c:501
    #6 0x55aa428f808c in tcl_call_stringproc_cd /home/michael/projects/eggdrop/src/tcl.c:340
    #7 0x7f5a9067b7e8 in TclNRRunCallbacks /usr/src/debug/tcl/tcl8.6.16/generic/tclBasic.c:4541
    #8 0x7f5a9067d973 in TclEvalEx /usr/src/debug/tcl/tcl8.6.16/generic/tclBasic.c:5409
    #9 0x7f5a9067e31a in Tcl_EvalEx /usr/src/debug/tcl/tcl8.6.16/generic/tclBasic.c:5075
    #10 0x7f5a9067e33a in Tcl_Eval /usr/src/debug/tcl/tcl8.6.16/generic/tclBasic.c:6001
    #11 0x7f5a9067e98f in Tcl_VarEvalVA /usr/src/debug/tcl/tcl8.6.16/generic/tclBasic.c:7001
    #12 0x7f5a9067ea71 in Tcl_VarEval /usr/src/debug/tcl/tcl8.6.16/generic/tclBasic.c:7033
    #13 0x55aa42922a01 in trigger_bind /home/michael/projects/eggdrop/src/tclhash.c:745
    #14 0x55aa42923fea in check_tcl_bind /home/michael/projects/eggdrop/src/tclhash.c:941
    #15 0x7b5a8af2d40d in check_tcl_fil .././filesys.mod/filesys.c:146
    #16 0x7b5a8af2fb1e in got_files_cmd .././filesys.mod/filesys.c:220
    #17 0x7b5a8af3140b in dcc_files .././filesys.mod/filesys.c:245
    #18 0x55aa428bb49d in mainloop main.c:788
    #19 0x55aa428bfa05 in main main.c:1220
    #20 0x7f5a8f227634  (/usr/lib/libc.so.6+0x27634) (BuildId: b5723831519024d9389a7453760c470fe9bb8dd1)
    #21 0x7f5a8f2276e8 in __libc_start_main (/usr/lib/libc.so.6+0x276e8) (BuildId: b5723831519024d9389a7453760c470fe9bb8dd1)
    #22 0x55aa427d2524 in _start (/home/michael/eggdrop/eggdrop-1.10.1+0x275524) (BuildId: 5037b95baac81f36ecc58c5cef78ba78dfcf0b77)

SUMMARY: AddressSanitizer: 9 byte(s) leaked in 1 allocation(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant