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

Skip to content

Commit 01c16e6

Browse files
committed
transport: сheck a pointer allocation result
GIT_ERROR_CHECK_ALLOC was added to check the return value of git__calloc().
1 parent a0d4326 commit 01c16e6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/libgit2/transport/register.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ static int custom_subtransport__action(
144144
git_remote_connect_options_dispose(&opts);
145145

146146
*out = git__calloc(1, sizeof(git_smart_subtransport_stream));
147+
GIT_ERROR_CHECK_ALLOC(*out);
147148
(*out)->subtransport = transport;
148149
(*out)->read = custom_subtransport_stream__read;
149150
(*out)->write = custom_subtransport_stream__write;
@@ -169,6 +170,7 @@ static void custom_subtransport__free(git_smart_subtransport *transport)
169170
static int custom_transport_callback(git_smart_subtransport **out, git_transport *owner, void *param)
170171
{
171172
struct custom_subtransport *subtransport = git__calloc(1, sizeof(struct custom_subtransport));
173+
GIT_ERROR_CHECK_ALLOC(subtransport);
172174
subtransport->called = (int *)param;
173175
subtransport->owner = owner;
174176
subtransport->subtransport.action = custom_subtransport__action;

0 commit comments

Comments
 (0)