Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
fix valgrind warnings
Browse files Browse the repository at this point in the history
==11454==
==11454== Conditional jump or move depends on uninitialised value(s)
==11454==    at 0x4601EC: i64toa (itoa.h:293)
==11454==    by 0x4601EC: WriteInt64 (writer.h:301)
==11454==    by 0x4601EC: rapidjson::Writer<rapidjson::BasicOStreamWrapper<std::ostream>, rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator, 0u>::Int64(long) (writer.h:176)
==11454==    by 0x464085: json_encode (json_helper.h:271)
==11454==    by 0x464085: encode_inner (json_helper.h:517)
==11454==    by 0x464085: encode (json_helper.h:541)
==11454==    by 0x464085: encode_json_state (replica_context.h:228)
==11454==    by 0x464085: encode_inner (json_helper.h:505)
==11454==    by 0x464085: encode (json_helper.h:541)
==11454==    by 0x464085: encode (json_helper.h:547)
==11454==    by 0x464085: dsn::json::json_forwarder<dsn::replication::cold_backup_metadata>::encode(dsn::replication::cold_backup_metadata const&) (json_helper.h:552)
==11454==    by 0x45D3F5: replication_service_test_app::read_backup_metadata_test() (cold_backup_context_test.cpp:230)
==11454==    by 0x494365: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==    by 0x48E125: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==    by 0x473EBE: testing::Test::Run() (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==    by 0x474747: testing::TestInfo::Run() (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==    by 0x474DD7: testing::TestCase::Run() (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==    by 0x47B51B: testing::internal::UnitTestImpl::RunAllTests() (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==    by 0x495743: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==    by 0x48EF1B: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==    by 0x47A1AD: testing::UnitTest::Run() (in /home/mi/git/release/pegasus/rdsn/builder/src/dist/replication/test/replica_test/unit_test/dsn.replica.test)
==11454==
  • Loading branch information
neverchanje committed Oct 15, 2018
1 parent 0a8c16a commit bd47ba2
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions include/dsn/cpp/json_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,7 @@ class json_forwarder
{
std::ostringstream os;
encode(os, t);
std::string *result = new std::string(os.str());
return dsn::blob(std::shared_ptr<char>(const_cast<char *>(result->c_str()),
[result](char *) { delete result; }),
result->length());
return blob::create_from_bytes(os.str());
}

static bool decode(const JsonObject &in, T &t)
Expand Down

0 comments on commit bd47ba2

Please sign in to comment.