[xiph-cvs] cvs commit: ao/src audio_out.c

Stan Seibert volsung at xiph.org
Sun Aug 31 08:09:50 PDT 2003



volsung     03/08/31 11:09:50

  Modified:    src      audio_out.c
  Log:
  Handle dlsym() errors correctly.  Patch from d95hjort at dtek.chalmers.se
  (Håkan Hjort).  Closes bug 260.

Revision  Changes    Path
1.27      +13 -8     ao/src/audio_out.c

Index: audio_out.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/audio_out.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- audio_out.c	29 Aug 2003 19:01:49 -0000	1.26
+++ audio_out.c	31 Aug 2003 15:09:50 -0000	1.27
@@ -120,32 +120,32 @@
                 }
 
                 dt->functions->test = dlsym(dt->handle, "ao_plugin_test");
-		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		if (!(dt->functions->test)) goto failed;
 
                 dt->functions->driver_info = 
                   dlsym(dt->handle, "ao_plugin_driver_info");
-		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		if (!(dt->functions->driver_info)) goto failed;
 
                 dt->functions->device_init = 
                   dlsym(dt->handle, "ao_plugin_device_init");
-		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		if (!(dt->functions->device_init )) goto failed;
 
                 dt->functions->set_option = 
                   dlsym(dt->handle, "ao_plugin_set_option");
-		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		if (!(dt->functions->set_option)) goto failed;
 
                 dt->functions->open = dlsym(dt->handle, "ao_plugin_open");
-		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		if (!(dt->functions->open)) goto failed;
 
                 dt->functions->play = dlsym(dt->handle, "ao_plugin_play");
-		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		if (!(dt->functions->play)) goto failed;
 
                 dt->functions->close = dlsym(dt->handle, "ao_plugin_close");
-		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		if (!(dt->functions->close)) goto failed;
 
                 dt->functions->device_clear = 
                   dlsym(dt->handle, "ao_plugin_device_clear");
-		if (dlerror()) { free(dt->functions); free(dt); return NULL; }
+		if (!(dt->functions->device_clear)) goto failed;
 
 
         } else {
@@ -153,6 +153,11 @@
         }
 
         return dt;
+
+ failed:
+	free(dt->functions);
+	free(dt);
+	return NULL;
 }
 
 

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list