[master] 0c975f6 NULL the pointer first, then destroy VSM segment.

Poul-Henning Kamp phk at FreeBSD.org
Mon Nov 27 12:30:12 UTC 2017


commit 0c975f603f3fc1d776f66071ba0b82a280c7029c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Nov 27 11:50:08 2017 +0000

    NULL the pointer first, then destroy VSM segment.

diff --git a/lib/libvcc/vsctool.py b/lib/libvcc/vsctool.py
index 7acc7a5..0670b82 100644
--- a/lib/libvcc/vsctool.py
+++ b/lib/libvcc/vsctool.py
@@ -216,10 +216,12 @@ class vscset(object):
 		fo.write("VSC_" + self.name + "_Destroy")
 		fo.write("(" + self.struct + " **pp)\n")
 		fo.write("{\n")
+		fo.write("\t" + self.struct + "*p;\n")
 		fo.write("\n")
 		fo.write("\tAN(pp);\n")
-		fo.write('\tVRT_VSC_Destroy(vsc_%s_name, *pp);\n' % self.name)
+		fo.write("\tp = *pp;\n")
 		fo.write("\t*pp = NULL;\n")
+		fo.write('\tVRT_VSC_Destroy(vsc_%s_name, p);\n' % self.name)
 		fo.write("}\n")
 
 		if 'sumfunction' in self.head.param:


More information about the varnish-commit mailing list