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

Skip to content

Commit 8a62bf1

Browse files
committed
netops: fix memory leak when an error occurs
1 parent b0f7512 commit 8a62bf1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/netops.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ int gitno_extract_url_parts(
261261
*path = git__substrdup(_path, u.field_data[UF_PATH].len);
262262
GITERR_CHECK_ALLOC(*path);
263263
} else {
264+
git__free(*port);
265+
*port = NULL;
266+
git__free(*host);
267+
*host = NULL;
264268
giterr_set(GITERR_NET, "invalid url, missing path");
265269
return GIT_EINVALIDSPEC;
266270
}

0 commit comments

Comments
 (0)