Fixing a couple of issues within core.

pull/6145/head
Nicolas "Pixel" Noble 9 years ago
parent 7c37a687eb
commit 5b30475396
  1. 3
      src/core/lib/channel/channel_args.c
  2. 4
      src/core/lib/surface/server.c

@ -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;

Loading…
Cancel
Save