Browse code

Fix memory leak in auth-pam plugin

As it says on the tin. aresp would not be free'd nor returned by
my_conv() on errors. Note that we never reach this code if allocation
of aresp failed.

Found with the Clang static analyzer.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <1445380706-20864-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10338
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Steffan Karger authored on 2015/10/21 07:38:26
Showing 1 changed files
... ...
@@ -642,6 +642,9 @@ my_conv (int n, const struct pam_message **msg_array,
642 642
 
643 643
   if (ret == PAM_SUCCESS)
644 644
     *response_array = aresp;
645
+  else
646
+    free(aresp);
647
+
645 648
   return ret;
646 649
 }
647 650