diff options
-rw-r--r-- | src/core/lib/slice/slice.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/core/lib/slice/slice.c b/src/core/lib/slice/slice.c index 1cddf062cd..da5dc3e52a 100644 --- a/src/core/lib/slice/slice.c +++ b/src/core/lib/slice/slice.c @@ -197,6 +197,7 @@ grpc_slice grpc_slice_new_with_len(void *p, size_t len, } grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t length) { + if (length == 0) return grpc_empty_slice(); grpc_slice slice = grpc_slice_malloc(length); memcpy(GRPC_SLICE_START_PTR(slice), source, length); return slice; |