1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

Plug leak on error path, spotted by Coverity. ok djm@

This commit is contained in:
dtucker 2024-12-12 09:09:09 +00:00
parent ced57b23db
commit feb3ea439d

View File

@ -1,4 +1,4 @@
/* $OpenBSD: auth2-pubkey.c,v 1.121 2024/12/06 16:24:27 djm Exp $ */
/* $OpenBSD: auth2-pubkey.c,v 1.122 2024/12/12 09:09:09 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2010 Damien Miller. All rights reserved.
@ -783,7 +783,7 @@ user_key_allowed(struct ssh *ssh, struct passwd *pw, struct sshkey *key,
int auth_attempt, struct sshauthopt **authoptsp)
{
u_int success = 0, i, j;
char *file, *conn_id;
char *file = NULL, *conn_id;
struct sshauthopt *opts = NULL;
const char *rdomain, *remote_ip, *remote_host;
@ -819,6 +819,8 @@ user_key_allowed(struct ssh *ssh, struct passwd *pw, struct sshkey *key,
if (r != GLOB_NOMATCH) {
logit_f("glob \"%s\" failed", file);
}
free(file);
file = NULL;
continue;
} else if (gl.gl_pathc > INT_MAX) {
fatal_f("too many glob results for \"%s\"", file);
@ -835,6 +837,7 @@ user_key_allowed(struct ssh *ssh, struct passwd *pw, struct sshkey *key,
}
}
free(file);
file = NULL;
globfree(&gl);
}
if (success)