aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-30 11:49:06 -0500
committerTed Gould <ted@gould.cx>2012-08-30 11:49:06 -0500
commitbda98f787c631e65e347e414b2bb1a3e0c10423a (patch)
treee62448f31d5f40474e51cf84bbd667557e4388c0 /src
parent63889954b78abbb9396fce05620f61e834e8a2ed (diff)
downloadlibpam-freerdp2-bda98f787c631e65e347e414b2bb1a3e0c10423a.tar.gz
libpam-freerdp2-bda98f787c631e65e347e414b2bb1a3e0c10423a.tar.bz2
libpam-freerdp2-bda98f787c631e65e347e414b2bb1a3e0c10423a.zip
Checking the return value of the mlock
Diffstat (limited to 'src')
-rw-r--r--src/pam-freerdp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index 89c5d5d..0e5c3fa 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -150,8 +150,13 @@ get_item (pam_handle_t * pamh, int type)
free(global_password);
}
global_password = strdup(promptval);
- mlock(global_password, strlen(global_password));
- retval = global_password;
+ if (mlock(global_password, strlen(global_password)) != 0) {
+ /* Woah, can't lock it. Can't keep it. */
+ free(global_password);
+ global_password = NULL;
+ } else {
+ retval = global_password;
+ }
}
free(promptval);