Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unitialized variables causes unknown behavior #9

Closed
kornefalk opened this issue Aug 5, 2015 · 1 comment
Closed

Unitialized variables causes unknown behavior #9

kornefalk opened this issue Aug 5, 2015 · 1 comment
Assignees

Comments

@kornefalk
Copy link

Trying to insert an array of Blob fails due to error in BindCheck (using C++ interface)

==30717== Conditional jump or move depends on uninitialised value(s)
==30717==    at 0x548B2E6: OCI_BindCheck (statement.c:297)
==30717==    by 0x548B758: OCI_ExecuteInternal (statement.c:1810)
==30717==    by 0x548B939: OCI_Execute (statement.c:2063)

The data used in OCI_BindCheck has unknown data which is allocated in:

template <class TObjectType, class TDataType>
inline void BindArray::BindArrayObject<TObjectType, TDataType>::AllocData()
{
    _data = new TDataType[_elemCount];
}

By adding memset, the problems with i.e. set an array of Blob disappears:

template <class TObjectType, class TDataType>
inline void BindArray::BindArrayObject<TObjectType, TDataType>::AllocData()
{
    _data = new TDataType[_elemCount];
    memset(_data, 0, sizeof(TDataType) * _elemCount);
}
@vrogier
Copy link
Owner

vrogier commented Aug 5, 2015

Hi,

Fix committed !

would it be possible for you to provide pull requests for such issues next time you find some ?

It would be quicker to integrate (one click thanks to github) and you would be then listed as contributor :)

Thanks

Vincent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants