realloc関数に問題があります:
***glibcが検出されました***realloc():無効な次のサイズ:
コードの関連部分は次のとおりです。
char* pathfile = NULL;
int tcpargc=6;
char *tcpargv[tcpargc];
int it;
for (it = 0;it < tcpargc;it++)
tcpargv[it] = NULL;
...
while (1) {
...
if (pathfile == NULL)
pathfile=(char*)malloc((strlen(RAMDIR)+strlen(tempfilename)+7)*sizeof(char));
else {
if ((tmp=(char*)realloc(pathfile,(strlen(RAMDIR)+strlen(tempfilename)+7)*sizeof(char))) == NULL)
{
printf("ERROR: realloc failed");
free(pathfile);
}
else
pathfile = tmp;
}
...
if (tcpargv[4] == NULL)
tcpargv[4]=(char*)malloc((strlen("--infile=")+strlen(pathfile)+1)*sizeof(char));
else {
if ((tmp = (char*)realloc(tcpargv[4],strlen("--infile=")+strlen(pathfile)+1)*sizeof(char))) == NULL){
printf("ERROR: realloc failed");
free(tcpargv[4]);
}
else
tcpargv[4] = tmp;
}
...
}
何度もチェックしましたが、エラーが見つかりませんでした。
助けてくれてありがとう。