Message ID | 20210620151204.19260-4-andrzej@ahunt.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix all leaks in tests t0002-t0099: Part 2 | expand |
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index ae6174ab05..4015d114b3 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -188,11 +188,13 @@ static char *relative_url(const char *remote_url, out = xstrdup(sb.buf + 2); else out = xstrdup(sb.buf); - strbuf_reset(&sb); - if (!up_path || !is_relative) + if (!up_path || !is_relative) { + strbuf_release(&sb); return out; + } + strbuf_reset(&sb); strbuf_addf(&sb, "%s%s", up_path, out); free(out); return strbuf_detach(&sb, NULL);