[master] ed99b32 Free struct vjsn

Federico G. Schwindt fgsch at lodoss.net
Thu Aug 31 14:44:06 CEST 2017


commit ed99b3242097a7632d33a9188cd2f3fd5b774862
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Thu Aug 31 13:13:42 2017 +0100

    Free struct vjsn

diff --git a/lib/libvarnishapi/vjsn.c b/lib/libvarnishapi/vjsn.c
index 65bc3b3..c189a68 100644
--- a/lib/libvarnishapi/vjsn.c
+++ b/lib/libvarnishapi/vjsn.c
@@ -90,7 +90,7 @@ vjsn_val_delete(struct vjsn_val *jsv)
 	FREE_OBJ(jsv);
 }
 
-static void
+void
 vjsn_delete(struct vjsn **jp)
 {
 	struct vjsn *js;
diff --git a/lib/libvarnishapi/vjsn.h b/lib/libvarnishapi/vjsn.h
index ee17a3d..3b2f16b 100644
--- a/lib/libvarnishapi/vjsn.h
+++ b/lib/libvarnishapi/vjsn.h
@@ -55,5 +55,6 @@ struct vjsn {
 };
 
 struct vjsn *vjsn_parse(const char *, const char **);
+void vjsn_delete(struct vjsn **);
 void vjsn_dump(const struct vjsn *js, FILE *fo);
 struct vjsn_val *vjsn_child(const struct vjsn_val *, const char *);
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index 399c054..a10a3ea 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -315,11 +315,7 @@ vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom,
 	p = (char*)fantom->b + 8 + vbe64dec(fantom->b);
 	assert (p < (char*)fantom->e);
 	vj = vjsn_parse(p, &e);
-	if (e != NULL) {
-		fprintf(stderr, "%s\n", p);
-		fprintf(stderr, "JSON ERROR %s\n", e);
-		exit(2);
-	}
+	XXXAZ(e);
 	AN(vj);
 	vve = vjsn_child(vj->value, "elem");
 	AN(vve);
@@ -328,7 +324,7 @@ vsc_iter_fantom(struct vsm *vd, const struct vsm_fantom *fantom,
 		if (i)
 			break;
 	}
-	// XXX: destroy vj
+	vjsn_delete(&vj);
 	return (i);
 }
 



More information about the varnish-commit mailing list