Fix numerous pa_operation leaks
Description
Many PulseAudio calls return a pa_operation
object that needs to be freed. https://gitlab.xfce.org/apps/xfce4-volumed-pulse/-/blob/master/src/xvd_pulse.c?ref_type=heads has some examples.
Example leak reports
Direct leak of 2024 byte(s) in 23 object(s) allocated from:
#0 0x745cc54fd891 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x745cb8fe156b in pa_xmalloc (/usr/lib/libpulse.so.0+0x3656b)
#2 0x745cb8fcb722 (/usr/lib/libpulse.so.0+0x20722)
#3 0x745cb8fcb7ff in pa_context_get_sink_info_by_name (/usr/lib/libpulse.so.0+0x207ff)
#4 0x745cb9198a77 in pulseaudio_volume_server_info_cb xfce4-pulseaudio-plugin/panel-plugin/pulseaudio-volume.c:369
#5 0x745cb8fbdf23 (/usr/lib/libpulse.so.0+0x12f23)
#6 0x745cb8f66501 (/usr/lib/pulseaudio/libpulsecommon-17.0.so+0x42501)
#7 0x745cb8f6775b in pa_pdispatch_run (/usr/lib/pulseaudio/libpulsecommon-17.0.so+0x4375b)
#8 0x745cb8fbe253 (/usr/lib/libpulse.so.0+0x13253)
#9 0x745cb8f6c5d4 (/usr/lib/pulseaudio/libpulsecommon-17.0.so+0x485d4)
#10 0x745cb8f6d46e (/usr/lib/pulseaudio/libpulsecommon-17.0.so+0x4946e)
#11 0x745cbc6bc5e7 (/usr/lib/libpulse-mainloop-glib.so.0+0x25e7)
[...snip...]
Direct leak of 2024 byte(s) in 23 object(s) allocated from:
#0 0x745cc54fd891 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x745cb8fe156b in pa_xmalloc (/usr/lib/libpulse.so.0+0x3656b)
#2 0x745cb8fcb722 (/usr/lib/libpulse.so.0+0x20722)
#3 0x745cb8fcc01f in pa_context_get_source_info_by_name (/usr/lib/libpulse.so.0+0x2101f)
#4 0x745cb9198ab4 in pulseaudio_volume_server_info_cb xfce4-pulseaudio-plugin/panel-plugin/pulseaudio-volume.c:370
#5 0x745cb8fbdf23 (/usr/lib/libpulse.so.0+0x12f23)
#6 0x745cb8f66501 (/usr/lib/pulseaudio/libpulsecommon-17.0.so+0x42501)
#7 0x745cb8f6775b in pa_pdispatch_run (/usr/lib/pulseaudio/libpulsecommon-17.0.so+0x4375b)
#8 0x745cb8fbe253 (/usr/lib/libpulse.so.0+0x13253)
#9 0x745cb8f6c5d4 (/usr/lib/pulseaudio/libpulsecommon-17.0.so+0x485d4)
#10 0x745cb8f6d46e (/usr/lib/pulseaudio/libpulsecommon-17.0.so+0x4946e)
#11 0x745cbc6bc5e7 (/usr/lib/libpulse-mainloop-glib.so.0+0x25e7)
[...snip...]
Testing
- No issues were detected when testing the patch with UBSan, LSan, and ASan