From 2099dde2c84a57cd9fe2298f0953c5dca0e94d43 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Mon, 10 Sep 2018 00:20:34 +0200 Subject: [PATCH] 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 --- lib/cookie.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/cookie.c b/lib/cookie.c index 732ba9b83..5b7ab6633 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; } /*****************************************************************************