You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by necouchman <gi...@git.apache.org> on 2017/09/27 17:04:13 UTC

[GitHub] incubator-guacamole-server pull request #114: GUACAMOLE-398: Fix memory leak...

GitHub user necouchman opened a pull request:

    https://github.com/apache/incubator-guacamole-server/pull/114

    GUACAMOLE-398: Fix memory leak identified by Coverity

    Quick fix to correct a memory leak identified by the latest Coverity scan in the common ssh code.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/necouchman/incubator-guacamole-server GUACAMOLE-398

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-guacamole-server/pull/114.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #114
    
----

----


---

[GitHub] incubator-guacamole-server pull request #114: GUACAMOLE-398: Fix memory leak...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/incubator-guacamole-server/pull/114#discussion_r141411562
  
    --- Diff: src/common-ssh/ssh.c ---
    @@ -457,6 +457,7 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
             if (fd < 0) {
                 guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
                         "Unable to create socket: %s", strerror(errno));
    +            free(addresses);
    --- End diff --
    
    The addresses returned by a call to `getaddrinfo()` actually have to be freed by a call to `freeaddrinfo()`:
    
    https://github.com/apache/incubator-guacamole-server/blob/afb554a0149391693615226060f567a5f2ef7d49/src/common-ssh/ssh.c#L487
    
    Since the result of calling `getaddrinfo()` is a dynamically-allocated linked list, invoking `free()` on the returned list will not necessarily free the entire list, but likely only a single element of that list.


---

[GitHub] incubator-guacamole-server pull request #114: GUACAMOLE-398: Fix memory leak...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/incubator-guacamole-server/pull/114#discussion_r141412631
  
    --- Diff: src/common-ssh/ssh.c ---
    @@ -457,6 +457,7 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
             if (fd < 0) {
                 guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
                         "Unable to create socket: %s", strerror(errno));
    +            free(addresses);
    --- End diff --
    
    ...and if I had looked a few lines down in the code I would have found that.  Should be fixed, now.


---

[GitHub] incubator-guacamole-server pull request #114: GUACAMOLE-398: Fix memory leak...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-guacamole-server/pull/114


---