oj 1.2.12 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oj might be problematic. Click here for more details.

data/README.md CHANGED
@@ -32,6 +32,10 @@ A fast JSON parser and Object marshaller as a Ruby gem.
32
32
 
33
33
  ## <a name="release">Release Notes</a>
34
34
 
35
+ ### Release 1.2.13
36
+
37
+ - Fixed double free bug in Oj::Doc that showed up for larger documents.
38
+
35
39
  ### Release 1.2.12
36
40
 
37
41
  - Fixed GC bug in Oj::Doc, the fast parser.
@@ -847,7 +847,7 @@ parse_json(VALUE clas, char *json, int given, int allocated) {
847
847
  rb_gc_unregister_address(&doc->self);
848
848
  DATA_PTR(doc->self) = 0;
849
849
  doc_free(pi.doc);
850
- if (allocated) {
850
+ if (allocated && 0 != ex) { // will jump so caller will not free
851
851
  xfree(json);
852
852
  }
853
853
  } else {
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '1.2.12'
4
+ VERSION = '1.2.13'
5
5
  end
@@ -81,8 +81,6 @@ class Bid
81
81
  end
82
82
  end
83
83
 
84
- #GC.disable
85
-
86
84
  class BidResponseParser
87
85
  REQUIRED_ATTRIBUTES = [:id, :impid, :price].freeze
88
86
 
@@ -92,8 +90,8 @@ class BidResponseParser
92
90
  end
93
91
 
94
92
  def self.extract_fast(json)
95
- doc = Oj::Doc.open(json)
96
- #Oj::Doc.open(json) do |doc|
93
+ bid = nil
94
+ Oj::Doc.open(json) do |doc|
97
95
  bid = Bid.new
98
96
 
99
97
  # bid-response object
@@ -128,10 +126,9 @@ class BidResponseParser
128
126
  end
129
127
 
130
128
  bid.price = doc.fetch("#{bid_path}/price").to_f
129
+ end
131
130
 
132
- doc.close # needed when not in Proc to cleanup
133
- return bid
134
- #end
131
+ return bid
135
132
  end
136
133
  end
137
134
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.12
4
+ version: 1.2.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'The fastest JSON parser and object serializer. '
15
15
  email: peter@ohler.com