From 965eab3aa2eb56cfa5df068390c71d513b1655e3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sat, 7 May 2016 22:11:37 -0700 Subject: Fix refcounting --- src/core/lib/iomgr/error.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/core/lib/iomgr/error.c') diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index d67eb6e425..6d16a54d57 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -240,8 +240,13 @@ grpc_error *grpc_error_set_int(grpc_error *src, grpc_error_ints which, return new; } -const intptr_t *grpc_error_get_int(grpc_error *err, grpc_error_ints which) { - return gpr_avl_get(err->ints, (void *)(uintptr_t)which); +bool grpc_error_get_int(grpc_error *err, grpc_error_ints which, intptr_t *p) { + void *pp; + if (gpr_avl_maybe_get(err->ints, (void *)(uintptr_t)which, &pp)) { + if (p != NULL) *p = (intptr_t)pp; + return true; + } + return false; } grpc_error *grpc_error_set_str(grpc_error *src, grpc_error_strs which, -- cgit v1.2.3