Skip to content
Snippets Groups Projects
Commit 5b304753 authored by Nicolas "Pixel" Noble's avatar Nicolas "Pixel" Noble
Browse files

Fixing a couple of issues within core.

parent 7c37a687
No related branches found
No related tags found
No related merge requests found
......@@ -74,7 +74,8 @@ grpc_channel_args *grpc_channel_args_copy_and_add(const grpc_channel_args *src,
return dst;
}
dst->num_args = src_num_args + num_to_add;
dst->args = gpr_malloc(sizeof(grpc_arg) * dst->num_args);
dst->args =
dst->num_args ? gpr_malloc(sizeof(grpc_arg) * dst->num_args) : NULL;
for (i = 0; i < src_num_args; i++) {
dst->args[i] = copy_arg(&src->args[i]);
}
......
......@@ -251,7 +251,9 @@ static void channel_broadcaster_init(grpc_server *s, channel_broadcaster *cb) {
count++;
}
cb->num_channels = count;
cb->channels = gpr_malloc(sizeof(*cb->channels) * cb->num_channels);
cb->channels = cb->num_channels
? gpr_malloc(sizeof(*cb->channels) * cb->num_channels)
: NULL;
count = 0;
for (c = s->root_channel_data.next; c != &s->root_channel_data; c = c->next) {
cb->channels[count++] = c->channel;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment