remote: release strbuf after use in set_url()
authorRene Scharfe <l.s.r@web.de>
Wed, 30 Aug 2017 18:00:27 +0000 (20:00 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Sep 2017 23:49:28 +0000 (08:49 +0900)
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/remote.c
index 0a56d7da669a40b970a35ee017227a1eddd5d091..33ba73933271b51986112107b97b4846e4a913b0 100644 (file)
@@ -1565,9 +1565,7 @@ static int set_url(int argc, const char **argv)
                                                       "^$", 0);
                else
                        git_config_set(name_buf.buf, newurl);
-               strbuf_release(&name_buf);
-
-               return 0;
+               goto out;
        }
 
        /* Old URL specified. Demand that one matches. */
@@ -1590,6 +1588,8 @@ static int set_url(int argc, const char **argv)
                git_config_set_multivar(name_buf.buf, newurl, oldurl, 0);
        else
                git_config_set_multivar(name_buf.buf, NULL, oldurl, 1);
+out:
+       strbuf_release(&name_buf);
        return 0;
 }