0

I am getting above error on following code. I have attached respective backtrace for the same

System details: Cent os: 7.5.1804 GCC: 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)

bool FileTransfer::dirExist(string strDirName)
{
    //error on below line
    DIR* dir = opendir(strDirName.c_str());
    if(NULL == dir)
       return false;
    else
       return true ;
}

and backtrace for above

#0  0x00007f36afe9c62c in malloc_consolidate () from /lib64/libc.so.6
#1  0x00007f36afe9e275 in _int_malloc () from /lib64/libc.so.6
#2  0x00007f36afea184c in malloc () from /lib64/libc.so.6
#3  0x00007f36afedc9c1 in __alloc_dir () from /lib64/libc.so.6
#4  0x00007f36b25cb7ec in FileTransfer::dirExist (this=this@entry=0x7fff0c1d5d60,strDirName="/home/praveen/file_process/TCP_DUMP/Process") at filetransfer.cc:15

Any Help is appreciated.

Praveenkumar
  • 921
  • 1
  • 9
  • 28
  • 1
    You probably have heap corruption before this code is executed. Run Valgrind on your program to identify the root cause. – selbie Dec 15 '18 at 06:50
  • @selbie I ran valgrind found that there was mistake in reading some conf file which hold the directories need to be processed. Thanks for suggestion. – Praveenkumar Dec 16 '18 at 11:30

0 Answers0