summaryrefslogtreecommitdiff
path: root/backends/oss/oss-backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/oss/oss-backend.c')
-rw-r--r--backends/oss/oss-backend.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/backends/oss/oss-backend.c b/backends/oss/oss-backend.c
index 70b32be..9726570 100644
--- a/backends/oss/oss-backend.c
+++ b/backends/oss/oss-backend.c
@@ -298,7 +298,7 @@ read_devices (OssBackend *oss)
for (i = 0; i < OSS_MAX_DEVICES; i++) {
gchar *path;
- gboolean added_current = FALSE;
+ gboolean added_current;
path = g_strdup_printf ("/dev/mixer%i", i);
@@ -333,6 +333,8 @@ read_device (OssBackend *oss, const gchar *path, gboolean *added)
gchar *bname;
gchar *label;
+ *added = FALSE;
+
fd = g_open (path, O_RDWR, 0);
if (fd == -1) {
if (errno != ENOENT && errno != ENXIO)
@@ -360,11 +362,13 @@ read_device (OssBackend *oss, const gchar *path, gboolean *added)
close (fd);
- if ((*added = oss_device_open (device)) == TRUE)
- add_device (oss, device);
- else
- g_object_unref (device);
-
+ if G_LIKELY (device != NULL) {
+ *added = oss_device_open (device);
+ if (*added == TRUE)
+ add_device (oss, device);
+ else
+ g_object_unref (device);
+ }
return *added;
}