segfault in g_slice_alloc
问题 I am calling a function with the following lines: void call_system_command(const char *command_params) { GString *cmd = g_string_sized_new(1024); g_string_append_printf(cmd, "/bin/bash /path/to/my/script '%s'", command_params); system(cmd->str); g_string_free(cmd, TRUE); } I am getting segfault in the line with g_string_sized_new. Backtrace from gdb shows: (gdb) bt #0 0x000000320ce56264 in g_slice_alloc () from /lib64/libglib-2.0.so.0 #1 0x000000320ce5c3db in g_string_sized_new () from /lib64