Skip to content

Commit

Permalink
http: Fix memory leak in do_https_request()
Browse files Browse the repository at this point in the history
Returning after a redirect can leak the oc_text_buf struct:

    ==5844== 4,120 (24 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 47 of 50
    ==5844==    at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==5844==    by 0x4E3CFDF: do_https_request (http.c:929)
    ==5844==    by 0x4E3D485: openconnect_obtain_cookie (http.c:1117)
    ==5844==    by 0x403135: main (main.c:1038)

So make sure we call buf_free() first.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
  • Loading branch information
cernekee committed Jul 27, 2014
1 parent e57699e commit 59e3883
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http.c
Expand Up @@ -1002,7 +1002,7 @@ static int do_https_request(struct openconnect_info *vpninfo, const char *method
result = handle_redirect(vpninfo);
if (result == 0) {
if (!fetch_redirect)
return 0;
goto out;
goto redirected;
}
goto out;
Expand Down

0 comments on commit 59e3883

Please sign in to comment.