Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if client_shared.c:client_connect fails, sub_client.c:main() doesn't call mosquitto_destroy #1513

Closed
basavesh opened this issue Nov 27, 2019 · 0 comments
Milestone

Comments

@basavesh
Copy link
Contributor

Repro: Start a mosquitto_sub without starting a broker.

valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./mosquitto_sub -v -t test
==23425== Memcheck, a memory error detector
==23425== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==23425== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==23425== Command: ./mosquitto_sub -v -t test
==23425==
Error: Connection refused
==23425==
==23425== FILE DESCRIPTORS: 5 open at exit.
==23425== Open AF_UNIX socket 6:
==23425== at 0x5176EFA: socketpair (syscall-template.S:78)
==23425== by 0x4E4757B: ??? (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x4E42945: ??? (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x4E42CEA: mosquitto_connect_bind_v5 (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x10ECC6: client_connect (client_shared.c:1201)
==23425== by 0x10A3DF: main (sub_client.c:332)
==23425==
==23425== Open AF_UNIX socket 5:
==23425== at 0x5176EFA: socketpair (syscall-template.S:78)
==23425== by 0x4E4757B: ??? (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x4E42945: ??? (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x4E42CEA: mosquitto_connect_bind_v5 (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x10ECC6: client_connect (client_shared.c:1201)
==23425== by 0x10A3DF: main (sub_client.c:332)
==23425==
==23425== Open file descriptor 2: /dev/pts/1
==23425==
==23425==
==23425== Open file descriptor 1: /dev/pts/1
==23425==
==23425==
==23425== Open file descriptor 0: /dev/pts/1
==23425==
==23425==
==23425==
==23425== HEAP SUMMARY:
==23425== in use at exit: 1,002 bytes in 3 blocks
==23425== total heap usage: 3,780 allocs, 3,777 frees, 176,188 bytes allocated
==23425==
==23425== 10 bytes in 1 blocks are still reachable in loss record 1 of 3
==23425== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23425== by 0x50F19B9: strdup (strdup.c:42)
==23425== by 0x4E428B5: ??? (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x4E42CEA: mosquitto_connect_bind_v5 (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x10ECC6: client_connect (client_shared.c:1201)
==23425== by 0x10A3DF: main (sub_client.c:332)
==23425==
==23425== 24 bytes in 1 blocks are still reachable in loss record 2 of 3
==23425== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23425== by 0x4E4299D: ??? (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x4E42CEA: mosquitto_connect_bind_v5 (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x10ECC6: client_connect (client_shared.c:1201)
==23425== by 0x10A3DF: main (sub_client.c:332)
==23425==
==23425== 968 bytes in 1 blocks are still reachable in loss record 3 of 3
==23425== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23425== by 0x4E4119E: mosquitto_new (in /usr/lib/x86_64-linux-gnu/libmosquitto.so.1)
==23425== by 0x10A363: main (sub_client.c:310)
==23425==
==23425== LEAK SUMMARY:
==23425== definitely lost: 0 bytes in 0 blocks
==23425== indirectly lost: 0 bytes in 0 blocks
==23425== possibly lost: 0 bytes in 0 blocks
==23425== still reachable: 1,002 bytes in 3 blocks
==23425== suppressed: 0 bytes in 0 blocks
==23425==
==23425== For counts of detected and suppressed errors, rerun with: -v
==23425== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

@ralight ralight added this to the 1.6.8 milestone Nov 28, 2019
ralight added a commit that referenced this issue Nov 28, 2019
@ralight ralight closed this as completed Nov 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants