fix: mem leak, test: config parsing until 300000lines and over 1 million structs
This commit is contained in:
6
file.c
6
file.c
@@ -23,6 +23,8 @@ int getFile(char *fname, char **strContent,int cbSize,long *neededSize)
|
||||
{
|
||||
return FILE_ERROR_OPEN;
|
||||
}
|
||||
|
||||
printf("file openend:%s",fname);
|
||||
fseek(hfile,0,SEEK_END);
|
||||
file_size = ftell(hfile);
|
||||
if(strContent == NULL) //we must determine the size and return to neededSize
|
||||
@@ -53,8 +55,8 @@ int getFile(char *fname, char **strContent,int cbSize,long *neededSize)
|
||||
//buffer end-3 = last character
|
||||
printf("strcontent: %ld, [%c]\n",*neededSize,*(*strContent+ *neededSize-3));
|
||||
*(*strContent + *neededSize -1) ='\0';
|
||||
printf("after zero assign: %ld, %s\n",*neededSize,*(strContent+ *neededSize-1));
|
||||
printf("content:%s",*strContent);
|
||||
printf("after zero assign: %ld, %s\n",*neededSize,(*strContent+ *neededSize-1));
|
||||
//printf("content:%s",*strContent);
|
||||
fclose(hfile);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user