mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 09:25:49 +00:00
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:
parent
b081b155cf
commit
fb40201672
@ -16,6 +16,7 @@
|
|||||||
#define FLAG_ALLOCATED_OPTION_FIELDS 0x1
|
#define FLAG_ALLOCATED_OPTION_FIELDS 0x1
|
||||||
#define FLAG_ALLOCATED_MESSAGE_BUFFER 0x2
|
#define FLAG_ALLOCATED_MESSAGE_BUFFER 0x2
|
||||||
#define FLAG_ALLOCATED_OPTION_ITEMS 0x4
|
#define FLAG_ALLOCATED_OPTION_ITEMS 0x4
|
||||||
|
#define FLAG_ALLOCATED_PAYLOAD 0x8
|
||||||
|
|
||||||
/* Linked List to store the options */
|
/* Linked List to store the options */
|
||||||
typedef struct _OPTION_ITEM {
|
typedef struct _OPTION_ITEM {
|
||||||
|
@ -353,5 +353,9 @@ void freeMessage(PRTSP_MESSAGE msg){
|
|||||||
if (msg->flags & FLAG_ALLOCATED_OPTION_ITEMS){
|
if (msg->flags & FLAG_ALLOCATED_OPTION_ITEMS){
|
||||||
freeOptionList(msg->options);
|
freeOptionList(msg->options);
|
||||||
}
|
}
|
||||||
free(msg);
|
|
||||||
|
/* If we've allocated the payload */
|
||||||
|
if (msg->flags & FLAG_ALLOCATED_PAYLOAD) {
|
||||||
|
free(msg->payload);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user