在执行整个代码后获得"分段错误"

the*_*tna 1 c gdb segmentation-fault

我执行所有C代码后出现了分段错误.它生成带有零字节内存泄漏的获取输出.之后,它显示"分段错误".以下是 gdb 输出.

 Program received signal SIGSEGV, Segmentation fault.
 0x08060f90 in _GLOBAL_OFFSET_TABLE_ ()
(gdb) bt 
#0  0x08060f90 in _GLOBAL_OFFSET_TABLE_ ()
#1  0xffbecd18 in ?? ()  
#2  0x15048815 in ?? ()
#3  0xcd0fbecd in ?? ()
#4  0x0610ffbe in ?? () 
#5  0xffbecd08 in ?? ()
#6  0xf7f79ff4 in ?? () from /lib/tls/libc.so.6
#7  0x00000000 in ?? ()
(gdb)
Run Code Online (Sandbox Code Playgroud)

编辑

    char **Connections,**Doors,**Zones;
    char *s1,*s2;
    char con[] = "c_";
    char zon[] = "z_";
    char dor[] = "d_";


   for (i=0; i<nc ; i++){
    s1 = con;
    s2 = string_IntToString(i);
    Connections[i]= string_Conc(s1,s2);  
    string_StringFree(s2);     
            }
Run Code Online (Sandbox Code Playgroud)

编辑

      char* string_Conc(const char* s1, const char* s2)
      { 
      char* dst;

    dst = memory_Malloc(strlen(s1) + strlen(s2) + 1);
    strcpy(dst, s1);
    return strcat(dst,s2);
      }
Run Code Online (Sandbox Code Playgroud)

unw*_*ind 7

正如评论者所指出的,这听起来像是缓冲区溢出或导致损坏的堆,调用堆栈或类似的其他事件.

您可以尝试通过Valgrind运行代码,它通常可以捕获这些错误.