Skip to content

Commit

Permalink
vty: fix pam memory leakage in case of failure/timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Oct 28, 2010
1 parent 526d9db commit 82e447c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vty.c
Expand Up @@ -167,7 +167,7 @@ int knet_vty_main_loop(const char *configfile, const char *ip_addr,
knet_vtys[conn_index].idle++;
if (knet_vtys[conn_index].idle > KNET_VTY_CLI_TIMEOUT) {
knet_vty_close(&knet_vtys[conn_index]);
pthread_cancel(knet_vtys[conn_index].vty_thread);
knet_vtys[conn_index].got_epipe = 1;
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions vty_auth.c
Expand Up @@ -204,6 +204,11 @@ static int knet_vty_pam_auth_user(struct knet_vty *vty, const char *user)
}

out_fatal:
if (pamh) {
pam_end(pamh, err);
pamh = NULL;
}

knet_vty_write(vty, "\n");

return err;
Expand Down

0 comments on commit 82e447c

Please sign in to comment.