]> git.ipfire.org Git - thirdparty/systemd.git/commit
resolvectl: free the block of memory 'hashed' points to before reusing it 9879/head
authorEvgeny Vereshchagin <evvers@ya.ru>
Thu, 16 Aug 2018 06:48:06 +0000 (06:48 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Thu, 16 Aug 2018 06:48:06 +0000 (06:48 +0000)
commit670e95aecda39c49a9ae9c2544203b628ed34d8b
tree644d29ccfe664c375ea1cd6b006cfcf65f8301c2
parent7cd98cc495ab6ecb405805eda189611d07d66213
resolvectl: free the block of memory 'hashed' points to before reusing it

This fixes a memory leak:
```
d5070e2f67ededca022f81f2941900606b16f3196b2268e856295f59._openpgpkey.gmail.com: resolve call failed: 'd5070e2f67ededca022f81f2941900606b16f3196b2268e856295f59._openpgpkey.gmail.com' not found

=================================================================
==224==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 65 byte(s) in 1 object(s) allocated from:
    #0 0x7f71b0878850 in malloc (/usr/lib64/libasan.so.4+0xde850)
    #1 0x7f71afaf69b0 in malloc_multiply ../src/basic/alloc-util.h:63
    #2 0x7f71afaf6c95 in hexmem ../src/basic/hexdecoct.c:62
    #3 0x7f71afbb574b in string_hashsum ../src/basic/gcrypt-util.c:45
    #4 0x56201333e0b9 in string_hashsum_sha256 ../src/basic/gcrypt-util.h:30
    #5 0x562013347b63 in resolve_openpgp ../src/resolve/resolvectl.c:908
    #6 0x562013348b9f in verb_openpgp ../src/resolve/resolvectl.c:944
    #7 0x7f71afbae0b0 in dispatch_verb ../src/basic/verbs.c:119
    #8 0x56201335790b in native_main ../src/resolve/resolvectl.c:2947
    #9 0x56201335880d in main ../src/resolve/resolvectl.c:3087
    #10 0x7f71ad8fcf29 in __libc_start_main (/lib64/libc.so.6+0x20f29)

SUMMARY: AddressSanitizer: 65 byte(s) leaked in 1 allocation(s).
```
src/resolve/resolvectl.c