Permalink
Browse files

http.c: free context in async mode

Change-Id: I0622c10bb93d5794f5f7871135bd64aceecc48b2
Reviewed-on: http://review.couchbase.org/23499
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
  • Loading branch information...
1 parent 92c0d50 commit db5845f25c733a15b693ddc47dcefc331ccdeca3 @funny-falcon funny-falcon committed with avsej Dec 21, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 ext/couchbase_ext/http.c
View
@@ -25,11 +25,13 @@ cb_http_complete_callback(lcb_http_request_t request, lcb_t handle, const void *
VALUE key, val, res, exc;
lcb_http_status_t status;
+ ctx->request->completed = 1;
+
if (bucket->destroying) {
+ cb_context_free(ctx);
return;
}
- ctx->request->completed = 1;
key = STR_NEW((const char*)resp->v.v0.path, resp->v.v0.npath);
val = resp->v.v0.nbytes ? STR_NEW((const char*)resp->v.v0.bytes, resp->v.v0.nbytes) : Qnil;
exc = ctx->exception;
@@ -69,6 +71,9 @@ cb_http_complete_callback(lcb_http_request_t request, lcb_t handle, const void *
if (!bucket->async && ctx->exception == Qnil) {
ctx->rv = res;
}
+ if (bucket->async) {
+ cb_context_free(ctx);
+ }
(void)handle;
(void)request;
}

0 comments on commit db5845f

Please sign in to comment.