aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2003-05-01 17:15:45 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2003-05-01 17:15:45 +0000
commit740d6dcde7e57c40f1b84809313beb00eddefc01 (patch)
tree1ba67b2c4137deb3802249530087cdffe76fba40
parent83a75cff45f34d07ccff93034acb2544498d4f76 (diff)
downloadsrc-740d6dcde7e57c40f1b84809313beb00eddefc01.tar.gz
src-740d6dcde7e57c40f1b84809313beb00eddefc01.zip
Initialize dlh (perforce change #30312)
Notes
Notes: svn path=/vendor/openpam/dist/; revision=114436
-rw-r--r--contrib/openpam/lib/openpam_dynamic.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/openpam/lib/openpam_dynamic.c b/contrib/openpam/lib/openpam_dynamic.c
index f169ed8c4c30..db5fe4825e19 100644
--- a/contrib/openpam/lib/openpam_dynamic.c
+++ b/contrib/openpam/lib/openpam_dynamic.c
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#6 $
+ * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#7 $
*/
#include <dlfcn.h>
@@ -57,6 +57,7 @@ openpam_dynamic(const char *path)
void *dlh;
int i;
+ dlh = NULL;
if ((module = calloc(1, sizeof *module)) == NULL)
goto buf_err;
@@ -77,7 +78,7 @@ openpam_dynamic(const char *path)
goto buf_err;
module->dlh = dlh;
for (i = 0; i < PAM_NUM_PRIMITIVES; ++i) {
- module->func[i] = dlsym(dlh, _pam_sm_func_name[i]);
+ module->func[i] = (pam_func_t)dlsym(dlh, _pam_sm_func_name[i]);
if (module->func[i] == NULL)
openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s",
path, _pam_sm_func_name[i], dlerror());
@@ -85,7 +86,8 @@ openpam_dynamic(const char *path)
return (module);
buf_err:
openpam_log(PAM_LOG_ERROR, "%m");
- dlclose(dlh);
+ if (dlh != NULL)
+ dlclose(dlh);
free(module);
return (NULL);
}