sio_sine example: unref device properly

closes #82
This commit is contained in:
Andrew Kelley 2016-06-13 16:48:22 -07:00
parent c2df644493
commit 67746c42ec

View file

@ -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;
}