mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-10-22 08:08:14 +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:
1 parent
b081b155cf
commit
fb40201672
2 files changed
+6
-1
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user