• 05-12-2002
I show some part of my code below (there are malloc funtions in this part)
At first time I use malloc function but not use free function and I debug my program and see value of c,d and o in debug window .They are correct. After that there are error message about dbgheap.c and sbheap.c I think this error cuase by malloc function.So I want to ask you about where can I use free function at this code

int i;
int k;
int l;
int m;
int n;
int len;
unsigned char *c;
unsigned char *d;
unsigned char *o;
int h = 0;
c = malloc(len*sizeof(unsigned char));
d = malloc(2*len*sizeof(unsigned char));
o = malloc(2*len*sizeof(unsigned char));
for(i=2;i<len-4;i+=5) {
/* Convert from base 900 to base 256 */
int j;
unsigned char b[6];
UInt64 codeval = 0;

if (i==len-5 && type!=924) break;
for(j=0;j<5;++j) {
codeval *= 900;
codeval += codewords[i+j];
}
for(j=0;j<6;++j) {
b[5-j] = codeval%256;
codeval >>= 8;
}

for(l=0;l<6;++l) {
c[h] = b[l];
++h;
k = h;
}
}
for(;i<len;++i) {
unsigned char b = codewords[i];
c[h] = b;
++h;
k = h;
}
m = 0;

for (h=0;h<k;++h){
n = c[h];
d[m] = n/16;
if ((d[m] >= 0)&&(d[m] < 10))
{
o[m] = d[m] + 48;
}
else if ((d[m] > 9) && (d[m] < 17))
{
o[m] = d[m] + 55;
}

d[m+1] = n%16;
if ((d[m+1] >= 0)&&(d[m+1] < 10))
{
o[m+1] = d[m+1] + 48;
}
else if ((d[m+1] > 9) && (d[m+1] < 17))
{
o[m+1] = d[m+1] + 55;
}
m = m+2;
}
• 05-12-2002
Okiesmokie
I vote that mods should DELETE any posts IMMEDIATLY that dont have CODE tags, anyone else with me?