Fixing a couple of issues within core.
diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c
index 28d2d78..97c40e8 100644
--- a/src/core/lib/channel/channel_args.c
+++ b/src/core/lib/channel/channel_args.c
@@ -74,7 +74,8 @@
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]);
}
diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c
index ad8ee8c..e3b54ac 100644
--- a/src/core/lib/surface/server.c
+++ b/src/core/lib/surface/server.c
@@ -251,7 +251,9 @@
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;