|
-
April 6th, 2009, 11:12 AM
#1
debug error: damage:after normal block..
Hi,
i have a dynamic byte array "ba". i have used it as follows
BYTE *ba = new BYTE[len]; //len is non zero
ZeroMemory(ba, sizeof(ba)*(len));
memcpy(ba,p_btPgBodyPtr+f_dwStrtTblOff,len);
...
....
....
if(ba)
delete [] ba; //i get debug error out here
can anybody help me solve this problem
thanks
Last edited by jude_aj; April 6th, 2009 at 11:15 AM.
-
April 6th, 2009, 11:30 AM
#2
Re: debug error: damage:after normal block..
Code:
BYTE *ba = new BYTE[len];
ZeroMemory(ba, sizeof(ba)*(len));
You are allocating far less bytes (len) than you are using (sizeof(ba)*len).
Note that sizeof(ba) is 'size of pointer to byte' and is not 'size of byte'.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|