Message ID | 20210725130830.5145-4-andrzej@ahunt.org (mailing list archive) |
---|---|
State | Accepted |
Commit | edfc744918fb130213633c024597f2aa25ff5de1 |
Headers | show |
Series | [v2,01/12] fmt-merge-msg: free newly allocated temporary strings when done | expand |
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 414fcb63ea..528a78eed8 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -187,11 +187,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);