From 139e851f22783da8f5ba3e99ae70e4fa34cdc77a Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Fri, 24 Sep 2021 08:20:31 +0200 Subject: [PATCH] Add null check before freeing DB Was causing segfaults in load-failure tests --- src/runtime/python/pypgf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c index dbf15ee7e..eeb76f7d5 100644 --- a/src/runtime/python/pypgf.c +++ b/src/runtime/python/pypgf.c @@ -13,7 +13,8 @@ static void PGF_dealloc(PGFObject *self) { - pgf_free_revision(self->db, self->revision); + if (self->db != NULL && self->revision != 0) + pgf_free_revision(self->db, self->revision); Py_TYPE(self)->tp_free((PyObject *)self); }