engine: fix memory leak in netchan

frag_message_buf wasn't always freed alongside with fragbuf_t
instead of ensuring frag_message_buf being freed, I turned it into
a flexible array member
This commit is contained in:
Alibek Omarov
2024-08-03 08:40:31 +03:00
parent e686b1410d
commit d6e77e531d
2 changed files with 3 additions and 5 deletions

View File

@@ -184,13 +184,13 @@ typedef struct fragbuf_s
struct fragbuf_s *next; // next buffer in chain
int bufferid; // id of this buffer
sizebuf_t frag_message; // message buffer where raw data is stored
byte *frag_message_buf; // the actual data sits here
qboolean isfile; // is this a file buffer?
qboolean isbuffer; // is this file buffer from memory ( custom decal, etc. ).
qboolean iscompressed; // is compressed file, we should using filename.ztmp
char filename[MAX_OSPATH]; // name of the file to save out on remote host
int foffset; // offset in file from which to read data
int size; // size of data to read at that offset
byte frag_message_buf[1]; // the actual data sits here (flexible)
} fragbuf_t;
// Waiting list of fragbuf chains