From 1fe38ffb7476df086c7d470e7f136dda92610c8e Mon Sep 17 00:00:00 2001
From: Julien Boeuf <jboeuf@google.com>
Date: Tue, 8 Sep 2015 17:21:05 -0700
Subject: [PATCH] Fixing #3286

- We cannot use call_data after the final callback as this one may
  trigger the deletion of the call object (hence the call_data).
---
 src/core/security/server_auth_filter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/security/server_auth_filter.c b/src/core/security/server_auth_filter.c
index b767f85498..d134201e87 100644
--- a/src/core/security/server_auth_filter.c
+++ b/src/core/security/server_auth_filter.c
@@ -128,9 +128,11 @@ static void on_md_processing_done(
     calld->num_consumed_md = num_consumed_md;
     grpc_metadata_batch_filter(&calld->md_op->data.metadata, remove_consumed_md,
                                elem);
+    grpc_metadata_array_destroy(&calld->md);
     calld->on_done_recv->cb(calld->on_done_recv->cb_arg, 1);
   } else {
     gpr_slice message;
+    grpc_metadata_array_destroy(&calld->md);
     error_details = error_details != NULL
                     ? error_details
                     : "Authentication metadata processing failed.";
@@ -139,7 +141,6 @@ static void on_md_processing_done(
     grpc_transport_stream_op_add_close(&calld->transport_op, status, &message);
     grpc_call_next_op(elem, &calld->transport_op);
   }
-  grpc_metadata_array_destroy(&calld->md);
 }
 
 static void auth_on_recv(void *user_data, int success) {
-- 
GitLab