Merge lp:~zorba-coders/zorba/bug-1021025 into lp:zorba

Proposed by Dennis Knochenwefel
Status: Merged
Approved by: Till Westmann
Approved revision: 10912
Merged at revision: 10914
Proposed branch: lp:~zorba-coders/zorba/bug-1021025
Merge into: lp:zorba
Diff against target: 38 lines (+5/-2)
1 file modified
src/runtime/json/json_impl.cpp (+5/-2)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1021025
Reviewer Review Type Date Requested Status
Till Westmann Approve
Ghislain Fourny Approve
Review via email: mp+113442@code.launchpad.net

Commit message

fixed memory leak reading data of zstring after destruction. Encoded illegal char in exception to not cause any problems.

Description of the change

fix for bug #1021025

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1021025-2012-07-04T18-07-03.899Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Pending.

Revision history for this message
Ghislain Fourny (gislenius) wrote :

Nice catch Dennis :-)

review: Approve
Revision history for this message
Till Westmann (tillw) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1021025-2012-07-05T16-52-53.307Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/runtime/json/json_impl.cpp'
--- src/runtime/json/json_impl.cpp 2012-06-28 04:14:03 +0000
+++ src/runtime/json/json_impl.cpp 2012-07-04 18:06:19 +0000
@@ -25,6 +25,7 @@
25#include "system/globalenv.h"25#include "system/globalenv.h"
2626
27#include "util/mem_streambuf.h"27#include "util/mem_streambuf.h"
28#include "util/string_util.h"
2829
29#include "jsonml_array.h"30#include "jsonml_array.h"
30#include "snelson.h"31#include "snelson.h"
@@ -63,6 +64,7 @@
63 options_type options;64 options_type options;
64 istringstream iss;65 istringstream iss;
65 mem_streambuf buf;66 mem_streambuf buf;
67 zstring s;
6668
67 PlanIteratorState *state;69 PlanIteratorState *state;
68 DEFAULT_STACK_INIT( PlanIteratorState, state, planState );70 DEFAULT_STACK_INIT( PlanIteratorState, state, planState );
@@ -78,7 +80,6 @@
78 if ( cur_item->isStreamable() ) {80 if ( cur_item->isStreamable() ) {
79 is = &cur_item->getStream();81 is = &cur_item->getStream();
80 } else {82 } else {
81 zstring s;
82 cur_item->getStringValue2( s );83 cur_item->getStringValue2( s );
83 // Doing it this way uses the string data in-place with no copy.84 // Doing it this way uses the string data in-place with no copy.
84 buf.set( s.data(), s.size() );85 buf.set( s.data(), s.size() );
@@ -104,7 +105,9 @@
104 catch ( json::illegal_character const &e ) {105 catch ( json::illegal_character const &e ) {
105 throw XQUERY_EXCEPTION(106 throw XQUERY_EXCEPTION(
106 zerr::ZJPE0001_ILLEGAL_CHARACTER,107 zerr::ZJPE0001_ILLEGAL_CHARACTER,
107 ERROR_PARAMS( e.get_char() ),108 ERROR_PARAMS(zstring("#x") +
109 BUILD_STRING(std::uppercase << std::hex
110 << (static_cast<unsigned int>(e.get_char()) & 0xFF)) ),
108 ERROR_LOC( e.get_loc() )111 ERROR_LOC( e.get_loc() )
109 );112 );
110 }113 }

Subscribers

People subscribed via source and target branches