From: Daniel Gustafsson Date: Sun, 9 Sep 2018 22:20:34 +0000 (+0200) Subject: cookies: Move failure case label to end of function X-Git-Tag: curl-7_62_0~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2099dde2c84a57cd9fe2298f0953c5dca0e94d43;p=thirdparty%2Fcurl.git cookies: Move failure case label to end of function Rather than jumping backwards to where failure cleanup happens to be performed, move the failure case to end of the function where it is expected per existing coding convention. Closes #2965 --- diff --git a/lib/cookie.c b/lib/cookie.c index 732ba9b835..5b7ab66337 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -1262,12 +1262,8 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, matches++; } - else { - fail: - /* failure, clear up the allocated chain and return NULL */ - Curl_cookie_freelist(mainco); - return NULL; - } + else + goto fail; } } } @@ -1305,6 +1301,11 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, } return mainco; /* return the new list */ + +fail: + /* failure, clear up the allocated chain and return NULL */ + Curl_cookie_freelist(mainco); + return NULL; } /*****************************************************************************