1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-02-27 06:54:15 +01:00

Fix two minor memory leaks in error paths

Found by cppcheck
This commit is contained in:
Gabriel Kihlman 2019-03-19 14:49:45 +01:00
parent eca00d0a58
commit 5498bcf53f
No known key found for this signature in database
GPG Key ID: C59A56181B3BF1F7

2
util.c
View File

@ -71,6 +71,7 @@ get_user_cfgfile_path(const char *common_path, const char *filename, const struc
}
i = snprintf(userfile, len, "%s/%s", common_path, filename);
if (i < 0 || i >= len) {
free(userfile);
return 0;
}
*fn = userfile;
@ -85,6 +86,7 @@ get_user_cfgfile_path(const char *common_path, const char *filename, const struc
}
i = snprintf(userfile, len, "%s/.yubico/%s", user->pw_dir, filename);
if (i < 0 || i >= len) {
free(userfile);
return 0;
}
*fn = userfile;