[master] e1d47464d don't assert on failing WS_Alloc

Nils Goroll nils.goroll at uplex.de
Sun Mar 17 09:32:06 UTC 2019


commit e1d47464de79fac1823688b7437d5c8dccf27528
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sun Mar 17 10:28:49 2019 +0100

    don't assert on failing WS_Alloc
    
    not even in vmod_debug because it sets the only catflap example for the
    time being.

diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index 6bbdbda1b..aa94579fe 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -689,7 +689,10 @@ xyzzy_catflap(VRT_CTX, VCL_ENUM type)
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	XXXAZ(req->vcf);
 	req->vcf = WS_Alloc(req->ws, sizeof *req->vcf);
-	AN(req->vcf);
+	if (req->vcf == NULL) {
+		VRT_fail(ctx, "WS_Alloc failed in debug.catflap()");
+		return;
+	}
 	INIT_OBJ(req->vcf, VCF_MAGIC);
 	if (type == VENUM(first) || type == VENUM(miss)) {
 		req->vcf->func = xyzzy_catflap_simple;


More information about the varnish-commit mailing list