diff --git a/limelight-common/Rtsp.h b/limelight-common/Rtsp.h index f9f698c..bc5cd94 100644 --- a/limelight-common/Rtsp.h +++ b/limelight-common/Rtsp.h @@ -16,6 +16,7 @@ #define FLAG_ALLOCATED_OPTION_FIELDS 0x1 #define FLAG_ALLOCATED_MESSAGE_BUFFER 0x2 #define FLAG_ALLOCATED_OPTION_ITEMS 0x4 +#define FLAG_ALLOCATED_PAYLOAD 0x8 /* Linked List to store the options */ typedef struct _OPTION_ITEM { diff --git a/limelight-common/RtspParser.c b/limelight-common/RtspParser.c index ac3d682..9f90946 100644 --- a/limelight-common/RtspParser.c +++ b/limelight-common/RtspParser.c @@ -353,5 +353,9 @@ void freeMessage(PRTSP_MESSAGE msg){ if (msg->flags & FLAG_ALLOCATED_OPTION_ITEMS){ freeOptionList(msg->options); } - free(msg); + + /* If we've allocated the payload */ + if (msg->flags & FLAG_ALLOCATED_PAYLOAD) { + free(msg->payload); + } } \ No newline at end of file