Re: Re: c4_Bytes destructor causes memory deallocation failure

Jean-Claude Wippler <[email protected]>
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
Arto Stimms wrote:

> It seems that the destructor releases the wrong
> memory.
> In the debug build it gives an assertion at the
> deallocation, but in a release build it gives no
> error.
> This just makes it worse though, since it may later
> try to use the released memory, causing a crash.
>
> Check this example program which on my machine fails
> after the fourth iteration:
>
> #include "mk4.h"
> #include <string>
> #include <iostream>
> using namespace std;
>
> void main() {
> 	c4_Storage storage("datafile.kit", true);
> 	c4_View v = storage.GetAs("v[b:B]");
>
> 	v.Add(c4_Row());
> 	c4_BytesProp pBytes("b");
>
> 	string teststring("Hello, this is a test!"); //
> len=22
> 	c4_Bytes textbytes(teststring.data(),
> teststring.length());
>
> 	for (int i=0;i < 100;++i) {
> 		cout << i << endl;
> 		c4_Bytes newbytes = pBytes(v[0]).Access(0, 17);
> 		pBytes(v[0]).Modify(textbytes, 0, textbytes.Size());
> 	}
> }
>
> I am using metakit 2.4.9.3 with the modify patch on
> windows.

I am not seeing this with the CVS build on Linux or Mac OS X.  Don't 
have a Windows compile setup ready this minute, could you check with 
latest CVS as well?

(FWIW, I had to add an AutoCommit() call to make anything end up on 
disk)

-jcw

_____________________________________________
Metakit mailing list  -  [email protected]
http://www.equi4.com/mailman/listinfo/metakit
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.