Skip to content

Commit abe5c8f

Browse files
committed
Detect use-after-free in debug mode
1 parent 288d82c commit abe5c8f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/tao/json/value.hh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ namespace tao
106106
Traits< D >::assign( *this, std::forward< T >( v ) );
107107
}
108108
catch( ... ) {
109-
unsafe_discard();
109+
discard();
110110
internal::rethrow();
111111
}
112112
}
@@ -117,7 +117,7 @@ namespace tao
117117
unsafe_assign( std::move( l ) );
118118
}
119119
catch( ... ) {
120-
unsafe_discard();
120+
discard();
121121
throw;
122122
}
123123
}
@@ -128,7 +128,7 @@ namespace tao
128128
unsafe_assign( l );
129129
}
130130
catch( ... ) {
131-
unsafe_discard();
131+
discard();
132132
throw;
133133
}
134134
}
@@ -140,6 +140,7 @@ namespace tao
140140
~basic_value() noexcept
141141
{
142142
unsafe_discard();
143+
assert( ( m_type = json::type::DISCARDED, true ) );
143144
}
144145

145146
static basic_value array( std::initializer_list< single< Traits > > && l )

0 commit comments

Comments
 (0)