From 28cf233d053ff8e04fcd847b634235144af8bede Mon Sep 17 00:00:00 2001 From: Stan Seibert <volsung@xiph.org> Date: Sun, 31 Aug 2003 15:09:50 +0000 Subject: [PATCH] =?UTF-8?q?Handle=20dlsym()=20errors=20correctly.=20=20Pat?= =?UTF-8?q?ch=20from=20d95hjort@dtek.chalmers.se=20(H=EF=BF=BDkan=20Hjort)?= =?UTF-8?q?.=20=20Closes=20bug=20260.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.xiph.org/trunk/ao@5261 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- src/audio_out.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/audio_out.c b/src/audio_out.c index da883f9..808afc0 100644 --- a/src/audio_out.c +++ b/src/audio_out.c @@ -120,32 +120,32 @@ static driver_list *_get_plugin(char *plugin_file) } 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 @@ static driver_list *_get_plugin(char *plugin_file) } return dt; + + failed: + free(dt->functions); + free(dt); + return NULL; } -- GitLab