Skip to content

Commit

Permalink
Merge pull request EOSIO#52 from EOSIO/larryk85-patch-1
Browse files Browse the repository at this point in the history
fix for use after free EOSIO#51
  • Loading branch information
larryk85 authored Aug 28, 2018
2 parents c7a6ac4 + 7118f1d commit 7d95ef9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libraries/eosiolib/multi_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,6 @@ class multi_index

datastream<const char*> ds( (char*)buffer, uint32_t(size) );

if ( max_stack_buffer_size < size_t(size) ) {
free(buffer);
}

auto itm = std::make_unique<item>( this, [&]( auto& i ) {
T& val = static_cast<T&>(i);
ds >> val;
Expand All @@ -588,7 +584,11 @@ class multi_index
auto pitr = itm->__primary_itr;

_items_vector.emplace_back( std::move(itm), pk, pitr );


if ( max_stack_buffer_size < size_t(size) ) {
free(buffer);
}

return *ptr;
} /// load_object_by_primary_iterator

Expand Down

0 comments on commit 7d95ef9

Please sign in to comment.