From: Philippe Antoine Date: Thu, 19 Nov 2020 13:29:48 +0000 (+0100) Subject: dnp3: fix memory leak with object containing bytearrays X-Git-Tag: suricata-6.0.1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5749024e3f21d503e074b59208e0753629552d1c;p=thirdparty%2Fsuricata.git dnp3: fix memory leak with object containing bytearrays --- diff --git a/scripts/dnp3-gen/dnp3-gen.py b/scripts/dnp3-gen/dnp3-gen.py index 5b68203fa3..b2226c3217 100755 --- a/scripts/dnp3-gen/dnp3-gen.py +++ b/scripts/dnp3-gen/dnp3-gen.py @@ -566,6 +566,13 @@ static int DNP3DecodeObjectG{{object.group}}V{{object.variation}}(const uint8_t return 1; error: if (object != NULL) { +{% for field in object.fields %} +{% if field.type == "bytearray" %} + if (object->{{field.name}} != NULL) { + SCFree(object->{{field.name}}); + } +{% endif %} +{% endfor %} SCFree(object); }