summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-04-17 22:27:47 +0200
committerBastien Nocera <hadess@hadess.net>2016-04-17 22:27:47 +0200
commit25bf3ed75fa604fa73e8b25241119a993fc659d6 (patch)
tree996887eef8a58ddc8bb67242033a55d1b69a49c4
parent8fc9c62a69b78ceeb349b1aa753dbcfca8971192 (diff)
downloadlibgnome-volume-control-25bf3ed75fa604fa73e8b25241119a993fc659d6.tar.gz
gvc-mixer-control: Really fix double-free when setting headset
In a28e23d9006a32c8982ad8bda11fec131c6b36e8, we said: The callbacks will be called repeatedly, once with data, and later on with eol == 0. Make sure to only free it when we get the eol call instead of once we've applied the settings. Whereas the docs say: When requesting all of these [instances] at once, the callback will be called multiple times, once for each object. When the list has been exhausted, the callback will be called without an information structure and the eol parameter set to a positive value. If an error occurs, the callback will be invoked without an information structure and eol set to a negative value. So, in all, we need to free our callback data when eol is positive, or negative. So, when it's not 0. Seems we got lucky in the original commit because the test machine only had a single soundcard.
-rw-r--r--gvc-mixer-control.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gvc-mixer-control.c b/gvc-mixer-control.c
index 5fb1f31..760b05d 100644
--- a/gvc-mixer-control.c
+++ b/gvc-mixer-control.c
@@ -2099,7 +2099,7 @@ sink_info_cb (pa_context *c,
int j;
const char *s;
- if (eol <= 0) {
+ if (eol != 0) {
port_status_data_free (data);
return;
}
@@ -2135,7 +2135,7 @@ source_info_cb (pa_context *c,
int j;
const char *s;
- if (eol <= 0) {
+ if (eol != 0) {
port_status_data_free (data);
return;
}