From 5d85cf384f7b6612121c7d30bfea9e1ea4c8e426 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Wed, 16 Dec 2009 14:14:15 -0500 Subject: [PATCH] minor: free buffer on invalid doc --- ext/cbson/cbson.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/cbson/cbson.c b/ext/cbson/cbson.c index 15d002f..56e95e2 100644 --- a/ext/cbson/cbson.c +++ b/ext/cbson/cbson.c @@ -459,6 +459,7 @@ static void write_doc(buffer_t buffer, VALUE hash, VALUE check_keys) { // make sure that length doesn't exceed 4MB if (length > 4 * 1024 * 1024) { + buffer_free(buffer); rb_raise(InvalidDocument, "Document too large: BSON documents are limited to 4MB."); return; }