File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ void finalizer_wrapper(SEXP p) {
37
37
T* ptr = (T*) R_ExternalPtrAddr (p);
38
38
RCPP_DEBUG_3 (" finalizer_wrapper<%s>(SEXP p = <%p>). ptr = %p" , DEMANGLE (T), p, ptr)
39
39
40
- // Clear before finalizing to avoid interesting behavior,
40
+ // Clear before finalizing to avoid interesting behavior
41
+ // like access of freed memory,
41
42
// e.g. https://github.com/r-dbi/RPostgres/issues/167
42
43
R_ClearExternalPtr (p);
43
44
@@ -181,6 +182,7 @@ class XPtr :
181
182
// default C++ finalizer is since delete NULL is a no-op).
182
183
// This clears the external pointer just before calling the finalizer,
183
184
// to avoid interesting behavior with co-dependent finalizers,
185
+ // like access of freed memory,
184
186
// e.g. https://github.com/r-dbi/RPostgres/issues/167.
185
187
finalizer_wrapper<T,Finalizer>(Storage::get__ ());
186
188
}
You can’t perform that action at this time.
0 commit comments