From: Adam Dickmeiss Date: Fri, 11 Sep 2015 19:11:52 +0000 (+0200) Subject: Fix leak in record parsing X-Git-Tag: v1.12.4~2 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=e16309327f36c5e29217fa869fe1b2cdb466d7de;p=pazpar2-moved-to-github.git Fix leak in record parsing Occurred when empty data was produced and metadata did not have the attribute "empty". The empty attribute was introduced in PAZ-858. --- diff --git a/src/session.c b/src/session.c index 49425d5..33cfc39 100644 --- a/src/session.c +++ b/src/session.c @@ -2190,6 +2190,8 @@ static int ingest_to_cluster(struct client *cl, if (!value0 || !*value0) { const char *empty = yaz_xml_get_prop(n, "empty"); + if (value0) + xmlFree(value0); if (!empty) continue; wrbuf_puts(wrbuf_disp, (const char *) empty); @@ -2197,9 +2199,8 @@ static int ingest_to_cluster(struct client *cl, else { wrbuf_puts(wrbuf_disp, (const char *) value0); - } - if (value0) xmlFree(value0); + } ser_md = &service->metadata[md_field_id]; // non-merged metadata