summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2019-09-13 13:14:39 +1000
committerDamien Miller <djm@mindrot.org>2019-09-13 13:15:19 +1000
commitec0e6243660bf2df30c620a6a0d83eded376c9c6 (patch)
tree256c41488c1e0471386bc3a272b243f400243f3c
parentc17e4638e5592688264fc0349f61bfc7b4425aa5 (diff)
memleak of buffer in sshpam_query
coverity report via Ed Maste; ok dtucker@
-rw-r--r--auth-pam.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/auth-pam.c b/auth-pam.c
index 55253e6ab..d3f400bc3 100644
--- a/auth-pam.c
+++ b/auth-pam.c
@@ -851,6 +851,7 @@ sshpam_query(void *ctx, char **name, char **info,
851 plen += mlen; 851 plen += mlen;
852 **echo_on = (type == PAM_PROMPT_ECHO_ON); 852 **echo_on = (type == PAM_PROMPT_ECHO_ON);
853 free(msg); 853 free(msg);
854 sshbuf_free(buffer);
854 return (0); 855 return (0);
855 case PAM_ERROR_MSG: 856 case PAM_ERROR_MSG:
856 case PAM_TEXT_INFO: 857 case PAM_TEXT_INFO:
@@ -879,6 +880,7 @@ sshpam_query(void *ctx, char **name, char **info,
879 **echo_on = 0; 880 **echo_on = 0;
880 ctxt->pam_done = -1; 881 ctxt->pam_done = -1;
881 free(msg); 882 free(msg);
883 sshbuf_free(buffer);
882 return 0; 884 return 0;
883 } 885 }
884 /* FALLTHROUGH */ 886 /* FALLTHROUGH */
@@ -905,6 +907,7 @@ sshpam_query(void *ctx, char **name, char **info,
905 **echo_on = 0; 907 **echo_on = 0;
906 ctxt->pam_done = 1; 908 ctxt->pam_done = 1;
907 free(msg); 909 free(msg);
910 sshbuf_free(buffer);
908 return (0); 911 return (0);
909 } 912 }
910 error("PAM: %s for %s%.100s from %.100s", msg, 913 error("PAM: %s for %s%.100s from %.100s", msg,
@@ -916,9 +919,11 @@ sshpam_query(void *ctx, char **name, char **info,
916 **echo_on = 0; 919 **echo_on = 0;
917 free(msg); 920 free(msg);
918 ctxt->pam_done = -1; 921 ctxt->pam_done = -1;
922 sshbuf_free(buffer);
919 return (-1); 923 return (-1);
920 } 924 }
921 } 925 }
926 sshbuf_free(buffer);
922 return (-1); 927 return (-1);
923} 928}
924 929