login_getclassbyname(3): use calloc.
This commit is contained in:
@@ -295,7 +295,7 @@ login_getclassbyname(char const *name, const struct passwd *pwd)
|
||||
{
|
||||
login_cap_t *lc;
|
||||
|
||||
if ((lc = malloc(sizeof(login_cap_t))) != NULL) {
|
||||
if ((lc = calloc(1, sizeof(login_cap_t))) != NULL) {
|
||||
int r, me, i = 0;
|
||||
uid_t euid = 0;
|
||||
gid_t egid = 0;
|
||||
@@ -332,9 +332,6 @@ login_getclassbyname(char const *name, const struct passwd *pwd)
|
||||
login_dbarray[i++] = path_login_conf;
|
||||
login_dbarray[i] = NULL;
|
||||
|
||||
memset(lc, 0, sizeof(login_cap_t));
|
||||
lc->lc_cap = lc->lc_class = lc->lc_style = NULL;
|
||||
|
||||
if (name == NULL || *name == '\0')
|
||||
name = LOGIN_DEFCLASS;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user