Dangling pointer bug in paddle/fluid/framework/executor.cc
Created by: sneaxiy
In the implementation of void Executor::Run(const ProgramDesc& program, Scope* scope, std::map<std::string, const LoDTensor*>* feed_targets, std::map<std::string, LoDTensor*>* fetch_targets, bool create_local_scope, bool create_vars, const std::string& feed_holder_name, const std::string& fetch_holder_name)
, when has_feed_ops
or has_fetch_ops
is false
, a temporary unique_ptr
object is created and the pointer it holds is assigned to copy_program
. Thus, copy_program
is a dangling pointer after the temporary object unique_ptr
is destructed.