This is what valgrind shows at the time of the crash ==15267== Conditional jump or move depends on uninitialised value(s) ==15267== at 0x4C228E3: drizzle_result_free (result.c:80) ==15267== by 0x408551: build_completion_hash(bool, bool) (drizzle.cc:2471) ==15267== by 0x40B423: com_rehash(std::string*, char const*) (drizzle.cc:3574) ==15267== by 0x408B11: reconnect() (drizzle.cc:2582) ==15267== by 0x408CCF: drizzleclient_real_query_for_lazy(char const*, int, drizzle_result_st*, unsigned int*) (drizzle.cc:2643) ==15267== by 0x409139: com_go(std::string*, char const*) (drizzle.cc:2742) ==15267== by 0x4078E6: add_line(std::string*, char*, char*, bool*) (drizzle.cc:2157) ==15267== by 0x406D29: read_and_execute(bool) (drizzle.cc:1915) ==15267== by 0x405D4D: main (drizzle.cc:1324) ==15267== ==15267== Use of uninitialised value of size 8 ==15267== at 0x4C23A10: drizzle_column_free (column.c:357) ==15267== by 0x4C228EC: drizzle_result_free (result.c:81) ==15267== by 0x408551: build_completion_hash(bool, bool) (drizzle.cc:2471) ==15267== by 0x40B423: com_rehash(std::string*, char const*) (drizzle.cc:3574) ==15267== by 0x408B11: reconnect() (drizzle.cc:2582) ==15267== by 0x408CCF: drizzleclient_real_query_for_lazy(char const*, int, drizzle_result_st*, unsigned int*) (drizzle.cc:2643) ==15267== by 0x409139: com_go(std::string*, char const*) (drizzle.cc:2742) ==15267== by 0x4078E6: add_line(std::string*, char*, char*, bool*) (drizzle.cc:2157) ==15267== by 0x406D29: read_and_execute(bool) (drizzle.cc:1915) ==15267== by 0x405D4D: main (drizzle.cc:1324) ==15267== ==15267== Invalid read of size 8 ==15267== at 0x4C23A10: drizzle_column_free (column.c:357) ==15267== by 0x4C228EC: drizzle_result_free (result.c:81) ==15267== by 0x408551: build_completion_hash(bool, bool) (drizzle.cc:2471) ==15267== by 0x40B423: com_rehash(std::string*, char const*) (drizzle.cc:3574) ==15267== by 0x408B11: reconnect() (drizzle.cc:2582) ==15267== by 0x408CCF: drizzleclient_real_query_for_lazy(char const*, int, drizzle_result_st*, unsigned int*) (drizzle.cc:2643) ==15267== by 0x409139: com_go(std::string*, char const*) (drizzle.cc:2742) ==15267== by 0x4078E6: add_line(std::string*, char*, char*, bool*) (drizzle.cc:2157) ==15267== by 0x406D29: read_and_execute(bool) (drizzle.cc:1915) ==15267== by 0x405D4D: main (drizzle.cc:1324) ==15267== Address 0x15b182e160 is not stack'd, malloc'd or (recently) free'd ==15267== ==15267== Process terminating with default action of signal 11 (SIGSEGV) ==15267== Access not within mapped region at address 0x15B182E160 ==15267== at 0x4C23A10: drizzle_column_free (column.c:357) ==15267== by 0x4C228EC: drizzle_result_free (result.c:81) ==15267== by 0x408551: build_completion_hash(bool, bool) (drizzle.cc:2471) ==15267== by 0x40B423: com_rehash(std::string*, char const*) (drizzle.cc:3574) ==15267== by 0x408B11: reconnect() (drizzle.cc:2582) ==15267== by 0x408CCF: drizzleclient_real_query_for_lazy(char const*, int, drizzle_result_st*, unsigned int*) (drizzle.cc:2643) ==15267== by 0x409139: com_go(std::string*, char const*) (drizzle.cc:2742) ==15267== by 0x4078E6: add_line(std::string*, char*, char*, bool*) (drizzle.cc:2157) ==15267== by 0x406D29: read_and_execute(bool) (drizzle.cc:1915) ==15267== by 0x405D4D: main (drizzle.cc:1324) ==15267== If you believe this happened as a result of a stack overflow in your ==15267== program's main thread (unlikely but possible), you can try to increase ==15267== the size of the main thread stack using the --main-stacksize= flag. ==15267== The main thread stack size used in this run was 10485760. ==15267== ==15267== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 6 from 2) ==15267== malloc/free: in use at exit: 185,212 bytes in 2,429 blocks. ==15267== malloc/free: 6,388 allocs, 3,959 frees, 1,032,930 bytes allocated. ==15267== For counts of detected errors, rerun with: -v ==15267== Use --track-origins=yes to see where uninitialised values come from ==15267== searching for pointers to 2,429 not-freed blocks. ==15267== checked 862,512 bytes. ==15267== ==15267== ==15267== 40 bytes in 2 blocks are definitely lost in loss record 7 of 22 ==15267== at 0x4A0763E: malloc (vg_replace_malloc.c:207) ==15267== by 0x31B3C2BEE5: xmalloc (in /lib64/libreadline.so.5.2) ==15267== by 0x31B3C14E7F: readline_internal_teardown (in /lib64/libreadline.so.5.2) ==15267== by 0x31B3C15113: readline (in /lib64/libreadline.so.5.2) ==15267== by 0x406BDC: read_and_execute(bool) (drizzle.cc:1884) ==15267== by 0x405D4D: main (drizzle.cc:1324) ==15267== ==15267== ==15267== 47,321 bytes in 1,408 blocks are possibly lost in loss record 21 of 22 ==15267== at 0x4A06FFC: operator new(unsigned long) (vg_replace_malloc.c:230) ==15267== by 0x31C0EA0140: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator const&) (in /usr/lib64/libstdc++.so.6.0.12) ==15267== by 0x31C0EA0D64: (within /usr/lib64/libstdc++.so.6.0.12) ==15267== by 0x31C0EA0F01: std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&) (in /usr/lib64/libstdc++.so.6.0.12) ==15267== by 0x40DAF8: __static_initialization_and_destruction_0(int, int) (drizzle.cc:135) ==15267== by 0x40DBAE: global constructors keyed to cmdline (drizzle.cc:4546) ==15267== by 0x42BD15: (within /home/wizard/projects/drizzle/drizzled/bin/drizzle) ==15267== by 0x4043CA: (within /home/wizard/projects/drizzle/drizzled/bin/drizzle) ==15267== ==15267== LEAK SUMMARY: ==15267== definitely lost: 40 bytes in 2 blocks. ==15267== possibly lost: 47,321 bytes in 1,408 blocks. ==15267== still reachable: 137,851 bytes in 1,019 blocks. ==15267== suppressed: 0 bytes in 0 blocks. ==15267== Reachable blocks (those to which a pointer was found) are not shown. ==15267== To see them, rerun with: --leak-check=full --show-reachable=yes Segmentation fault