From: Tobias Stoeckmann Date: Mon, 12 Aug 2024 15:37:03 +0000 (+0200) Subject: Treat out of memory as error X-Git-Tag: v2.42-start~241^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f79b2cf4177844fb64773a119f1cb1e41c8ccaf8;p=thirdparty%2Futil-linux.git Treat out of memory as error Otherwise it might happen that a configured file location is not taken into account. A NULL value would lead to default file location. --- diff --git a/pam_lastlog2/src/pam_lastlog2.c b/pam_lastlog2/src/pam_lastlog2.c index e800700bf..c3ca989c1 100644 --- a/pam_lastlog2/src/pam_lastlog2.c +++ b/pam_lastlog2/src/pam_lastlog2.c @@ -189,6 +189,8 @@ write_login_data (pam_handle_t *pamh, int ctrl, const char *user) return PAM_SYSTEM_ERR; struct ll2_context *context = ll2_new_context(lastlog2_path); + if (context == NULL) + return PAM_SYSTEM_ERR; if (ll2_write_entry (context, user, ll_time, tty, rhost, pam_service, &error) != 0) { if (error) { @@ -220,6 +222,8 @@ show_lastlogin (pam_handle_t *pamh, int ctrl, const char *user) return retval; struct ll2_context *context = ll2_new_context(lastlog2_path); + if (context == NULL) + return PAM_SYSTEM_ERR; if (ll2_read_entry (context, user, &ll_time, &tty, &rhost, &service, &error) != 0) { if (errno == ENOENT)