[PATCH/RFC V2 15/26] library: Free zlib state

Kevin Cernekee cernekee at gmail.com
Sun Aug 11 21:49:16 EDT 2013


Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 library.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/library.c b/library.c
index 869f3d7..f4449a3 100644
--- a/library.c
+++ b/library.c
@@ -38,6 +38,7 @@
 #endif
 
 #include <libxml/tree.h>
+#include <zlib.h>
 
 #include "openconnect-internal.h"
 
@@ -179,7 +180,12 @@ void openconnect_vpninfo_free(struct openconnect_info *vpninfo)
 	if (vpninfo->oath_secret)
 		oath_done();
 #endif
-	/* No need to free deflate streams; they weren't initialised */
+
+	/* These check strm->state so they are safe to call multiple times */
+	inflateEnd(&vpninfo->inflate_strm);
+	deflateEnd(&vpninfo->deflate_strm);
+
+	free(vpninfo->deflate_pkt);
 	free(vpninfo);
 }
 
-- 
1.7.9.5




More information about the openconnect-devel mailing list