[master] da790a8 VMOD blob tests: add vcl.discard to test freeing cached encodings of blob objects.

Geoff Simmons geoff at uplex.de
Mon Sep 11 13:24:05 UTC 2017


commit da790a8a537fc2f4aef4aa0630f1a2400a17ee72
Author: Geoff Simmons <geoff at uplex.de>
Date:   Mon Sep 11 15:22:06 2017 +0200

    VMOD blob tests: add vcl.discard to test freeing cached encodings of
    blob objects.
    
    Revealed by GCOV.

diff --git a/bin/varnishtest/tests/m00043.vtc b/bin/varnishtest/tests/m00043.vtc
index 74763b5..7c3408a 100644
--- a/bin/varnishtest/tests/m00043.vtc
+++ b/bin/varnishtest/tests/m00043.vtc
@@ -269,6 +269,10 @@ client c3 {
 # run twice
 client c3 -run
 
+# Discard to test object finalization
+varnish v1 -cliok "vcl.discard vcl1"
+varnish v1 -cliok "vcl.discard vcl2"
+
 varnish v1 -errvcl {vmod blob error: cannot create blob err, illegal encoding beginning with "g"} {
 	import blob;
 	backend b { .host="${bad_ip}"; }
diff --git a/lib/libvmod_blob/vmod_blob.c b/lib/libvmod_blob/vmod_blob.c
index e936944..20e44b7 100644
--- a/lib/libvmod_blob/vmod_blob.c
+++ b/lib/libvmod_blob/vmod_blob.c
@@ -307,7 +307,7 @@ vmod_blob__fini(struct vmod_blob_blob **blobp)
 	}
 	for (int i = 0; i < __MAX_ENCODING; i++)
 		if (b->encoding[i] != NULL && b->encoding[i][0] != '\0') {
-			free((void *) b->encoding[i]);
+			free(b->encoding[i]);
 			b->encoding[i] = NULL;
 		}
 	AZ(pthread_mutex_destroy(&b->lock));


More information about the varnish-commit mailing list