GUACAMOLE-422: Try to avoid memory leaks with mimetypes.
This commit is contained in:
parent
340aef5362
commit
54f88531d4
@ -622,6 +622,8 @@ int __guac_handshake_size_handler(guac_user* user, int argc, char** argv) {
|
|||||||
|
|
||||||
int __guac_handshake_audio_handler(guac_user* user, int argc, char** argv) {
|
int __guac_handshake_audio_handler(guac_user* user, int argc, char** argv) {
|
||||||
|
|
||||||
|
guac_free_mimetypes((char **) user->info.audio_mimetypes);
|
||||||
|
|
||||||
/* Store audio mimetypes */
|
/* Store audio mimetypes */
|
||||||
user->info.audio_mimetypes = (const char**) guac_copy_mimetypes(argv, argc);
|
user->info.audio_mimetypes = (const char**) guac_copy_mimetypes(argv, argc);
|
||||||
|
|
||||||
@ -631,6 +633,8 @@ int __guac_handshake_audio_handler(guac_user* user, int argc, char** argv) {
|
|||||||
|
|
||||||
int __guac_handshake_video_handler(guac_user* user, int argc, char** argv) {
|
int __guac_handshake_video_handler(guac_user* user, int argc, char** argv) {
|
||||||
|
|
||||||
|
guac_free_mimetypes((char **) user->info.video_mimetypes);
|
||||||
|
|
||||||
/* Store video mimetypes */
|
/* Store video mimetypes */
|
||||||
user->info.video_mimetypes = (const char**) guac_copy_mimetypes(argv, argc);
|
user->info.video_mimetypes = (const char**) guac_copy_mimetypes(argv, argc);
|
||||||
|
|
||||||
@ -640,6 +644,8 @@ int __guac_handshake_video_handler(guac_user* user, int argc, char** argv) {
|
|||||||
|
|
||||||
int __guac_handshake_image_handler(guac_user* user, int argc, char** argv) {
|
int __guac_handshake_image_handler(guac_user* user, int argc, char** argv) {
|
||||||
|
|
||||||
|
guac_free_mimetypes((char **) user->info.image_mimetypes);
|
||||||
|
|
||||||
/* Store image mimetypes */
|
/* Store image mimetypes */
|
||||||
user->info.image_mimetypes = (const char**) guac_copy_mimetypes(argv, argc);
|
user->info.image_mimetypes = (const char**) guac_copy_mimetypes(argv, argc);
|
||||||
|
|
||||||
@ -680,6 +686,9 @@ char** guac_copy_mimetypes(char** mimetypes, int count) {
|
|||||||
|
|
||||||
void guac_free_mimetypes(char** mimetypes) {
|
void guac_free_mimetypes(char** mimetypes) {
|
||||||
|
|
||||||
|
if (mimetypes == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
char** current_mimetype = mimetypes;
|
char** current_mimetype = mimetypes;
|
||||||
|
|
||||||
/* Free all strings within NULL-terminated mimetype array */
|
/* Free all strings within NULL-terminated mimetype array */
|
||||||
|
@ -235,6 +235,10 @@ int guac_user_handle_connection(guac_user* user, int usec_timeout) {
|
|||||||
guac_socket* socket = user->socket;
|
guac_socket* socket = user->socket;
|
||||||
guac_client* client = user->client;
|
guac_client* client = user->client;
|
||||||
|
|
||||||
|
user->info.audio_mimetypes = NULL;
|
||||||
|
user->info.image_mimetypes = NULL;
|
||||||
|
user->info.video_mimetypes = NULL;
|
||||||
|
|
||||||
/* Send args */
|
/* Send args */
|
||||||
if (guac_protocol_send_args(socket, client->args)
|
if (guac_protocol_send_args(socket, client->args)
|
||||||
|| guac_socket_flush(socket)) {
|
|| guac_socket_flush(socket)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user