Add FLAG_ALLOCATED_PAYLOAD to tell freeMessage() to also free the payload buffer. Don't free the message itself in freeMessage() because it's always stack allocated

This commit is contained in:
Cameron Gutman
2014-08-17 19:08:32 -07:00
parent b081b155cf
commit fb40201672
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -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);
}
}