builtin/apply: free patch when parse_chunk() fails
authorChristian Couder <christian.couder@gmail.com>
Wed, 16 Mar 2016 19:35:11 +0000 (20:35 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Apr 2016 17:21:55 +0000 (10:21 -0700)
commit7a6a44c2dc7a59ef8e117c2f1ea3c06ce6a6ff1f
treeb90e5bee15576156d8a7ca926255bbdb78790ba7
parent484e77615872b2a62775a6a2dcb1cad0f529c5d3
builtin/apply: free patch when parse_chunk() fails

When parse_chunk() fails it can return -1, for example
when find_header() doesn't find a patch header.

In this case it's better in apply_patch() to free the
"struct patch" that we just allocated instead of
leaking it.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/apply.c