From 67746c42eca519ed8a3a657de028e47a659629a0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 13 Jun 2016 16:48:22 -0700 Subject: [PATCH] sio_sine example: unref device properly closes #82 --- example/sio_sine.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/example/sio_sine.c b/example/sio_sine.c index c33ce8b..562fce0 100644 --- a/example/sio_sine.c +++ b/example/sio_sine.c @@ -179,7 +179,9 @@ int main(int argc, char **argv) { int device_count = soundio_output_device_count(soundio); for (int i = 0; i < device_count; i += 1) { struct SoundIoDevice *device = soundio_get_output_device(soundio, i); - if (strcmp(device->id, device_id) == 0 && device->is_raw == raw) { + bool select_this_one = strcmp(device->id, device_id) == 0 && device->is_raw == raw; + soundio_device_unref(device); + if (select_this_one) { selected_device_index = i; break; }