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). ```
Loading
Please register or sign in to comment