http2: fix handle leak in error path #1416

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@lstefani
Contributor

Add missing newhandle free call in push_promise().

@lstefani lstefani Update http2.c
Add missing newhandle free call in push_promise().
c675619

@lstefani, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bagder, @tatsuhiro-t and @jay to be potential reviewers.

@bagder bagder changed the title from Update http2.c to http2: fix handle leak in error path Apr 13, 2017
@bagder

Good catch, but it seems to me that moving the Curl_close(newhandle); call to the fail: label is a better fix, and then we can remove it from the other error checks that goto fail. What do you think?

Contributor

I wouldn't recommend that, based on the current placement of the fail: label (it's a drop-through for good cases). However, you could add a return rv; right before the fail: label to take care of the drop-through (non-goto cases). Also, notice that we goto on alloc fail, so you'd need to confirm that it's safe to call Curl_close() with a NULL pointer.

@bagder bagder added a commit that closed this pull request Apr 15, 2017
@lstefani @bagder lstefani + bagder http2: fix handle leak in error path
Add missing newhandle free call in push_promise().

Closes #1416
1451271
@bagder bagder closed this in 1451271 Apr 15, 2017
Owner
bagder commented Apr 15, 2017

Right, and newhandle had a different scope too. I decided to let your change be and merge that. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment