Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 704554c

Browse files
committed
transports: smart: fix memory leak on OOM path
1 parent 038d7af commit 704554c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/transports/smart_protocol.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
108108
if (giterr_last()->klass != GITERR_NOMEMORY)
109109
goto on_invalid;
110110

111+
git__free(mapping);
111112
return error;
112113
}
113114

@@ -120,6 +121,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
120121
on_invalid:
121122
giterr_set(GITERR_NET, "remote sent invalid symref");
122123
git_refspec__free(mapping);
124+
git__free(mapping);
123125
return -1;
124126
}
125127

0 commit comments

Comments
 (0)