From 957b1de1ad2a0beea442aeecd943ff6caa25df30 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 2 Sep 2017 16:09:22 -0700 Subject: [PATCH] Fix double-free and memory leak in RTSP option parsing failure path --- src/RtspParser.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/RtspParser.c b/src/RtspParser.c index 1f120f8..f8d8f47 100644 --- a/src/RtspParser.c +++ b/src/RtspParser.c @@ -159,7 +159,6 @@ int parseRtspMessage(PRTSP_MESSAGE msg, char* rtspMessage, int length) { // Create a new node containing the option and content newOpt = (POPTION_ITEM)malloc(sizeof(OPTION_ITEM)); if (newOpt == NULL) { - freeOptionList(options); exitCode = RTSP_ERROR_NO_MEMORY; goto ExitFailure; } @@ -221,7 +220,7 @@ int parseRtspMessage(PRTSP_MESSAGE msg, char* rtspMessage, int length) { ExitFailure: if (options) { - free(options); + freeOptionList(options); } if (messageBuffer) { free(messageBuffer);