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-5.0.5~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef3d2573f36533523659ce0ea434c6316a6a9017;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 c5f2ce5668..3f1b124dc6 100755 --- a/scripts/dnp3-gen/dnp3-gen.py +++ b/scripts/dnp3-gen/dnp3-gen.py @@ -574,6 +574,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); }