Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix memory leak for array elements

  • Loading branch information...
commit f7ee3f33f2cc4cf3f6f654707ef451628ef83c79 1 parent 8df1d89
@mnunberg authored
Showing with 9 additions and 3 deletions.
  1. +3 −0  Changes
  2. +4 −1 SL.xs
  3. +2 −2 lib/JSON/SL.pm
View
3  Changes
@@ -1,4 +1,7 @@
Revision history for JSON-SL
+0.06 September 17 2012
+ Fix memory leak for array elements
+
0.04 april 6 2012
Added left-out dependency
View
5 SL.xs
@@ -361,7 +361,10 @@ object_mkresult_THX(pTHX_
SvREADONLY_off(parent->sv);
SvREFCNT_inc_simple_void_NN(child->sv);
if (parent->type == JSONSL_T_LIST) {
- av_pop((AV*)parent->sv);
+ SV *popped_sv = av_pop((AV*)parent->sv);
+ if (popped_sv) {
+ SvREFCNT_dec(popped_sv);
+ }
} else {
char *kbuf;
STRLEN klen;
View
4 lib/JSON/SL.pm
@@ -16,7 +16,7 @@ use base qw(Exporter);
our @EXPORT_OK = qw(decode_json unescape_json_string);
BEGIN {
- $VERSION = '0.06';
+ $VERSION = '0.07';
require XSLoader;
XSLoader::load(__PACKAGE__, $VERSION);
}
@@ -515,4 +515,4 @@ L<JSON::SL::Tuba> - Same core with an event-oriented interface, like SAX
Copyright (C) 2012 M. Nunberg
This module contains extracts from L<JSON::XS>, nevertheless they are both
-licensed under the same terms as Perl itself.
+licensed under the same terms as Perl itself.
Please sign in to comment.
Something went wrong with that request. Please try again.