aboutsummaryrefslogtreecommitdiff
path: root/src/pam-freerdp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pam-freerdp.c')
-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);