]> code.delx.au - pulseaudio/commitdiff
* only load an OSS driver for the first device of a sound card, similar to what is...
authorLennart Poettering <lennart@poettering.net>
Sat, 12 Aug 2006 13:18:34 +0000 (13:18 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 12 Aug 2006 13:18:34 +0000 (13:18 +0000)
* fix a mem leak

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1217 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/modules/module-hal-detect.c

index 54d139ecbdb37e5a442529082b89d1b6ca10d747..825fa96ce93418a405ee75cdf90e7f42ae87702e 100644 (file)
@@ -192,26 +192,33 @@ static dbus_bool_t hal_device_is_oss_pcm(LibHalContext *ctx, const char *udi,
                                          DBusError *error)
 {
     dbus_bool_t rv = FALSE;
-    char* device;
-    char* type;
+    char* type, *device_file = NULL;
+    int device;
 
     type = libhal_device_get_property_string(ctx, udi, "oss.type", error);
     if (!type || dbus_error_is_set(error))
         return FALSE;
-
+    
     if (!strcmp(type, "pcm")) {
-        device = libhal_device_get_property_string(ctx, udi, "oss.device_file",
+        char *e;
+
+        device = libhal_device_get_property_int(ctx, udi, "oss.device", error);
+        if (dbus_error_is_set(error) || device != 0)
+            goto exit;
+
+        device_file = libhal_device_get_property_string(ctx, udi, "oss.device_file",
                                                    error);
-        if (!device || dbus_error_is_set(error))
+        if (!device_file || dbus_error_is_set(error))
             goto exit;
 
         /* hack to ignore /dev/audio style devices */
-        if ((device = strrchr(device, '/')))
-            rv = (pa_startswith(device + 1, "audio")) ? FALSE : TRUE;
+        if ((e = strrchr(device_file, '/')))
+            rv = !pa_startswith(e + 1, "audio");
     }
 
 exit:
     libhal_free_string(type);
+    libhal_free_string(device_file);
     return rv;
 }