diff options
author | Craig Tiller <ctiller@google.com> | 2017-04-12 09:37:47 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-04-12 09:37:47 -0700 |
commit | 9f99c303d01c706306eb54a5cfd0a23e1e76c6e3 (patch) | |
tree | cf9288713ede510a687d9194765260ef8b0a169b /src/core/lib/slice | |
parent | ca3b32f67d2dcce8cf09612a24fee93aa69c5a7f (diff) |
Handle 0-length
Diffstat (limited to 'src/core/lib/slice')
-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; |