[xiph-commits] r16844 - trunk/ao/src/plugins/oss

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Jan 28 11:47:19 PST 2010


Author: xiphmont
Date: 2010-01-28 11:47:19 -0800 (Thu, 28 Jan 2010)
New Revision: 16844

Modified:
   trunk/ao/src/plugins/oss/ao_oss.c
Log:
Apply patch as found in Debian BZ #316724


Modified: trunk/ao/src/plugins/oss/ao_oss.c
===================================================================
--- trunk/ao/src/plugins/oss/ao_oss.c	2010-01-28 18:53:04 UTC (rev 16843)
+++ trunk/ao/src/plugins/oss/ao_oss.c	2010-01-28 19:47:19 UTC (rev 16844)
@@ -82,11 +82,11 @@
 int _open_default_oss_device (char **dev_path, int blocking)
 {
 	int fd;
-	char *err = NULL;
-	char *dev = NULL;
 
 	/* default: first try the devfs path */
-	*dev_path = strdup("/dev/sound/dsp");
+	if(!(*dev_path = strdup("/dev/sound/dsp")))
+          return -1;
+
 #ifdef BROKEN_OSS
 	fd = open(*dev_path, O_WRONLY | O_NONBLOCK);
 #else
@@ -97,10 +97,9 @@
 	if(fd < 0)
 	{
 		/* no? then try the traditional path */
-		err = strdup(strerror(errno));
-		dev = strdup(*dev_path);
 		free(*dev_path);
-		*dev_path = strdup("/dev/dsp");
+		if(!(*dev_path = strdup("/dev/dsp")))
+                  return -1;
 #ifdef BROKEN_OSS
 		fd = open(*dev_path, O_WRONLY | O_NONBLOCK);
 #else
@@ -128,9 +127,6 @@
 		*dev_path = NULL;
 	}
 
-	if (err) free(err);
-	if (dev) free(dev);
-
 	return fd;
 }
 
@@ -185,7 +181,8 @@
 	if (!strcmp(key, "dsp")) {
 		/* Free old string in case "dsp" set twice in options */
 		free(internal->dev);
-		internal->dev = strdup(value);
+		if(!(internal->dev = strdup(value)))
+                  return 1;
 	}
 
 	return 1;



More information about the commits mailing list