From 8b7eea88d8ac5225f5b429be04e226eed5462793 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Tue, 30 Jun 1998 16:06:07 +0000 Subject: [PATCH] (auth): free `app_data' (sec_end): only destroy if it was initialized git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5044 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/security.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/appl/ftp/ftp/security.c b/appl/ftp/ftp/security.c index 2638aa763..9ddd9fdb9 100644 --- a/appl/ftp/ftp/security.c +++ b/appl/ftp/ftp/security.c @@ -409,6 +409,7 @@ auth(char *auth_name) return; } } + free (app_data); reply(504, "%s is unknown to me", auth_name); } @@ -713,12 +714,14 @@ sec_login(char *host) void sec_end(void) { - if(mech->end) - (*mech->end)(app_data); + if (mech != NULL) { + if(mech->end) + (*mech->end)(app_data); + memset(app_data, 0, mech->size); + free(app_data); + } sec_complete = 0; data_prot = 0; - memset(app_data, 0, mech->size); - free(app_data); } #endif /* FTP_SERVER */