Merge pull request #112 from glyptodon/fix-resource-leaks
GUAC-1389: Fix resource leaks reported by static analysis.
This commit is contained in:
commit
4d443efe0f
@ -445,6 +445,9 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free addrinfo */
|
||||||
|
freeaddrinfo(addresses);
|
||||||
|
|
||||||
/* If unable to connect to anything, fail */
|
/* If unable to connect to anything, fail */
|
||||||
if (current_address == NULL) {
|
if (current_address == NULL) {
|
||||||
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR,
|
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR,
|
||||||
@ -453,9 +456,6 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free addrinfo */
|
|
||||||
freeaddrinfo(addresses);
|
|
||||||
|
|
||||||
/* Allocate new session */
|
/* Allocate new session */
|
||||||
guac_common_ssh_session* common_session =
|
guac_common_ssh_session* common_session =
|
||||||
malloc(sizeof(guac_common_ssh_session));
|
malloc(sizeof(guac_common_ssh_session));
|
||||||
|
@ -687,6 +687,7 @@ int guac_client_load_plugin(guac_client* client, const char* protocol) {
|
|||||||
if (dlerror() != NULL) {
|
if (dlerror() != NULL) {
|
||||||
guac_error = GUAC_STATUS_INTERNAL_ERROR;
|
guac_error = GUAC_STATUS_INTERNAL_ERROR;
|
||||||
guac_error_message = dlerror();
|
guac_error_message = dlerror();
|
||||||
|
dlclose(client_plugin_handle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,6 +318,7 @@ int guac_png_write(guac_socket* socket, guac_stream* stream,
|
|||||||
png_info = png_create_info_struct(png);
|
png_info = png_create_info_struct(png);
|
||||||
if (!png_info) {
|
if (!png_info) {
|
||||||
png_destroy_write_struct(&png, NULL);
|
png_destroy_write_struct(&png, NULL);
|
||||||
|
guac_palette_free(palette);
|
||||||
guac_error = GUAC_STATUS_INTERNAL_ERROR;
|
guac_error = GUAC_STATUS_INTERNAL_ERROR;
|
||||||
guac_error_message = "libpng failed to create info structure";
|
guac_error_message = "libpng failed to create info structure";
|
||||||
return -1;
|
return -1;
|
||||||
@ -326,6 +327,7 @@ int guac_png_write(guac_socket* socket, guac_stream* stream,
|
|||||||
/* Set error handler */
|
/* Set error handler */
|
||||||
if (setjmp(png_jmpbuf(png))) {
|
if (setjmp(png_jmpbuf(png))) {
|
||||||
png_destroy_write_struct(&png, &png_info);
|
png_destroy_write_struct(&png, &png_info);
|
||||||
|
guac_palette_free(palette);
|
||||||
guac_error = GUAC_STATUS_IO_ERROR;
|
guac_error = GUAC_STATUS_IO_ERROR;
|
||||||
guac_error_message = "libpng output error";
|
guac_error_message = "libpng output error";
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user