From: Arran Cudbard-Bell Date: Wed, 30 May 2018 15:11:37 +0000 (+0600) Subject: Free anything we alloc in mod_decode if decoding the detail entry fails X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a8f9d750aa021aa219560d56faebcadfa3caac0;p=thirdparty%2Ffreeradius-server.git Free anything we alloc in mod_decode if decoding the detail entry fails Not strictly necessary but usually a good thing to do --- diff --git a/src/modules/proto_detail/proto_detail.c b/src/modules/proto_detail/proto_detail.c index fe239597cda..5eee8b314b4 100644 --- a/src/modules/proto_detail/proto_detail.c +++ b/src/modules/proto_detail/proto_detail.c @@ -250,7 +250,7 @@ static int mod_decode(void const *instance, REQUEST *request, uint8_t *const dat MPRINT("HEADER %s", data); if (sscanf((char const *) data, "%*s %*s %*d %*d:%*d:%*d %d", &num) != 1) { - RDEBUG("Malformed header '%s'", (char const *) data); + REDEBUG("Malformed header '%s'", (char const *) data); return -1; } @@ -263,6 +263,7 @@ static int mod_decode(void const *instance, REQUEST *request, uint8_t *const dat lineno = 1; fr_cursor_init(&cursor, &request->packet->vps); + fr_cursor_tail(&cursor); /* Ensure we only free what we add on error */ /* * Parse each individual line. @@ -281,7 +282,8 @@ static int mod_decode(void const *instance, REQUEST *request, uint8_t *const dat * doesn't hurt to re-check it here. */ if ((*p != '\0') && (*p != '\t')) { - RDEBUG("Malformed line %d", lineno); + REDEBUG("Malformed line %d", lineno); + fr_cursor_free_list(&cursor); return -1; }