From c2fafe1be0fb72aa1bd521efe2f524074bf143c7 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Fri, 15 Dec 2023 10:14:11 +0100 Subject: treewide: replace malloc followed by strcpy with strdup Suggested-by: Benny Baumann Signed-off-by: Tobias Stoeckmann --- modules/pam_listfile/pam_listfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules/pam_listfile') diff --git a/modules/pam_listfile/pam_listfile.c b/modules/pam_listfile/pam_listfile.c index a01b5a8a..3e6a7092 100644 --- a/modules/pam_listfile/pam_listfile.c +++ b/modules/pam_listfile/pam_listfile.c @@ -106,10 +106,9 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED, } else if(!strcmp(mybuf,"file")) { free(ifname); - ifname = malloc(strlen(myval)+1); + ifname = strdup(myval); if (!ifname) return PAM_BUF_ERR; - strcpy(ifname,myval); } else if(!strcmp(mybuf,"item")) if(!strcmp(myval,"user")) citem = PAM_USER; -- cgit v1.2.3