mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
value_and_holder: uninit members (#1660)
fix some uninitialized members in `value_and_holder` for some of the constructurs. Found with coverity in a downstream project.
This commit is contained in:
parent
868d94fcb4
commit
38f408fccd
@ -204,10 +204,10 @@ PYBIND11_NOINLINE inline handle get_type_handle(const std::type_info &tp, bool t
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct value_and_holder {
|
struct value_and_holder {
|
||||||
instance *inst;
|
instance *inst = nullptr;
|
||||||
size_t index;
|
size_t index = 0u;
|
||||||
const detail::type_info *type;
|
const detail::type_info *type = nullptr;
|
||||||
void **vh;
|
void **vh = nullptr;
|
||||||
|
|
||||||
// Main constructor for a found value/holder:
|
// Main constructor for a found value/holder:
|
||||||
value_and_holder(instance *i, const detail::type_info *type, size_t vpos, size_t index) :
|
value_and_holder(instance *i, const detail::type_info *type, size_t vpos, size_t index) :
|
||||||
@ -216,7 +216,7 @@ struct value_and_holder {
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
// Default constructor (used to signal a value-and-holder not found by get_value_and_holder())
|
// Default constructor (used to signal a value-and-holder not found by get_value_and_holder())
|
||||||
value_and_holder() : inst{nullptr} {}
|
value_and_holder() {}
|
||||||
|
|
||||||
// Used for past-the-end iterator
|
// Used for past-the-end iterator
|
||||||
value_and_holder(size_t index) : index{index} {}
|
value_and_holder(size_t index) : index{index} {}
|
||||||
@ -270,8 +270,8 @@ public:
|
|||||||
|
|
||||||
struct iterator {
|
struct iterator {
|
||||||
private:
|
private:
|
||||||
instance *inst;
|
instance *inst = nullptr;
|
||||||
const type_vec *types;
|
const type_vec *types = nullptr;
|
||||||
value_and_holder curr;
|
value_and_holder curr;
|
||||||
friend struct values_and_holders;
|
friend struct values_and_holders;
|
||||||
iterator(instance *inst, const type_vec *tinfo)
|
iterator(instance *inst, const type_vec *tinfo)
|
||||||
|
Loading…
Reference in New Issue
Block a user