fix: mem leak, test: config parsing until 300000lines and over 1 million structs

This commit is contained in:
jonathan santis
2025-05-20 15:27:49 +02:00
parent d07e4d9617
commit a834abc8e7
5 changed files with 156 additions and 98 deletions

6
file.c
View File

@@ -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;
}