valgrind ./nc-timestamp-mapper -n GIOPS-Daily -h -i /home/nabil/giops-daily/ -o /home/nabil/netcdf-timestamp-mapper/build/
==4013== Memcheck, a memory error detector
==4013== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==4013== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==4013== Command: ./nc-timestamp-mapper -n GIOPS-Daily -h -i /home/nabil/giops-daily/ -o /home/nabil/netcdf-timestamp-mapper/build/
==4013==
--4013-- WARNING: Serious error when reading debug info
--4013-- When reading debug info from /usr/lib/x86_64-linux-gnu/libnetcdf_c++4.so.1.0.2:
--4013-- Ignoring non-Dwarf2/3/4 block in .debug_info
--4013-- WARNING: Serious error when reading debug info
--4013-- When reading debug info from /usr/lib/x86_64-linux-gnu/libnetcdf_c++4.so.1.0.2:
--4013-- Last block truncated in .debug_info; ignoring
--4013-- WARNING: Serious error when reading debug info
--4013-- When reading debug info from /usr/lib/x86_64-linux-gnu/libnetcdf_c++4.so.1.0.2:
--4013-- parse_CU_Header: is neither DWARF2 nor DWARF3 nor DWARF4
List of non-indexed files not found. Continuing with complete indexing operation...
Creating list of all .nc files in "/home/nabil/giops-daily/"...
Building dataset description from 2 .nc file(s).
100% [|||||||||||||||||||||||||||||||||||||||||||||||||||||]
Opening database...
Inserting new values into database...
Error preparing SQL statement: INSERT INTO TimestampVariableFilepath(filepath_id, variable_id, timestamp_id) VALUES ((SELECT id FROM Filepaths WHERE filepath = @PT), (SELECT id FROM Variables WHERE variable = @VR), (SELECT id from Timestamps WHERE timestamp = @TS)) ON CONFLICT DO NOTHING; . Error code 1
==4013== Invalid read of size 8
==4013== at 0x50B09F2: sqlite3_clear_bindings (in /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6)
==4013== by 0x425A0F: tsm::Database::populateHistoricalJoinTable(tsm::ds::DatasetDesc const&) (in /home/nabil/netcdf-timestamp-mapper/build/nc-timestamp-mapper)
==4013== by 0x427012: tsm::Database::insertHistorical(tsm::ds::DatasetDesc const&) (in /home/nabil/netcdf-timestamp-mapper/build/nc-timestamp-mapper)
==4013== by 0x409839: tsm::TimestampMapper::exec() (in /home/nabil/netcdf-timestamp-mapper/build/nc-timestamp-mapper)
==4013== by 0x407801: main (in /home/nabil/netcdf-timestamp-mapper/build/nc-timestamp-mapper)
==4013== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==4013==
==4013==
==4013== Process terminating with default action of signal 11 (SIGSEGV)
==4013== Access not within mapped region at address 0x0
==4013== at 0x50B09F2: sqlite3_clear_bindings (in /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6)
==4013== by 0x425A0F: tsm::Database::populateHistoricalJoinTable(tsm::ds::DatasetDesc const&) (in /home/nabil/netcdf-timestamp-mapper/build/nc-timestamp-mapper)
==4013== by 0x427012: tsm::Database::insertHistorical(tsm::ds::DatasetDesc const&) (in /home/nabil/netcdf-timestamp-mapper/build/nc-timestamp-mapper)
==4013== by 0x409839: tsm::TimestampMapper::exec() (in /home/nabil/netcdf-timestamp-mapper/build/nc-timestamp-mapper)
==4013== by 0x407801: main (in /home/nabil/netcdf-timestamp-mapper/build/nc-timestamp-mapper)
==4013== If you believe this happened as a result of a stack
==4013== overflow in your program's main thread (unlikely but
==4013== possible), you can try to increase the size of the
==4013== main thread stack using the --main-stacksize= flag.
==4013== The main thread stack size used in this run was 8388608.
==4013==
==4013== HEAP SUMMARY:
==4013== in use at exit: 483,705 bytes in 1,169 blocks
==4013== total heap usage: 9,134 allocs, 7,965 frees, 2,407,869 bytes allocated
==4013==
==4013== LEAK SUMMARY:
==4013== definitely lost: 0 bytes in 0 blocks
==4013== indirectly lost: 0 bytes in 0 blocks
==4013== possibly lost: 1,032 bytes in 1 blocks
==4013== still reachable: 482,673 bytes in 1,168 blocks
==4013== of which reachable via heuristic:
==4013== length64 : 158,576 bytes in 249 blocks
==4013== suppressed: 0 bytes in 0 blocks
==4013== Rerun with --leak-check=full to see details of leaked memory
==4013==
==4013== For counts of detected and suppressed errors, rerun with: -v
==4013== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
I'm using valgrind to catch what's going on.