minor: free buffer on invalid doc

This commit is contained in:
Kyle Banker 2009-12-16 14:14:15 -05:00
parent aaf590214c
commit 5d85cf384f

View File

@ -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;
}