Using LZO function lzo1x_decompress(),but VS reports:Access conflict

198 Views Asked by At

I want to decompress data from a file,the code is as follows:

FILE* fp2;
lzo_bytep in;
lzo_bytep out1;
lzo_uint out_len;
lzo_uint file_len;
lzo_uint new_len;
err = fopen_s(&fp2, "file1.txt", "r+");
long cur = ftell(fp2);
fseek(fp2, 0L, SEEK_END);
file_len = ftell(fp2);`
fseek(fp2, cur, SEEK_SET);
out_len=file_len*2;
out1 = (lzo_bytep)malloc(out_len);
int err1 = fread(out1, file_len, 1, fp2);
in = (lzo_bytep)malloc(IN_LEN);
int r = lzo1x_decompress(out1, out_len, in, &new_len, NULL);

The lengh of IN_LEN is big enough,the space of the array out1 is big enough too,but why VS keep reporting Access conflict?

0

There are 0 best solutions below