zeromq/czmq — pull request #362 by m-marsella (2014-01-16 23:50:27+00:00)
Title: Fix invalid frame memory leak in s_beacon_recv

In s_beacon_recv when a beacon frame is valid it is added to the zmsg which takes ownership and frees it later. However an invalid beacon frame isn't added and not freed so this was causing a memory leak.

==30415== HEAP SUMMARY:
==30415== in use at exit: 264 bytes in 6 blocks
==30415== total heap usage: 280 allocs, 274 frees, 130,421 bytes allocated
==30415==
==30415== 264 bytes in 6 blocks are definitely lost in loss record 1 of 1
==30415== at 0x4C2C494: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==30415== by 0x419438: zframe_new (czmq_prelude.h:463)
==30415== by 0x42418D: zsys_udp_recv (zsys.c:492)
==30415== by 0x414CB7: s_agent_task (zbeacon.c:608)
==30415== by 0x4244CE: s_thread_shim (zthread.c:93)
==30415== by 0x4E3BF6D: start_thread (pthread_create.c:311)
==30415== by 0x586A9CC: clone (clone.S:113)
==30415==
==30415== LEAK SUMMARY:
==30415== definitely lost: 264 bytes in 6 blocks
==30415== indirectly lost: 0 bytes in 0 blocks
==30415== possibly lost: 0 bytes in 0 blocks
==30415== still reachable: 0 bytes in 0 blocks
==30415== suppressed: 0 bytes in 0 blocks
==30415==
==30415== For counts of detected and suppressed errors, rerun with: -v
==30415== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)