Subject Firebird Linux segfault compiled gcc3.4
Author Todd Fisher
Hi,
I have an application that links statically to firebird and am
getting the following stake trace when running with valgrind:

The invalid free is happening when I call IBPP::Prepare, which looks
like an invalid free finally happening in firebird. This is the
firebird 1.5.2 code base.

Does, this appear like it could be something i'm doing? It only appears to crash
my program sometimes, like maybe there is a race condition? My application
is not multi-threaded when making database calls.

thanks,
todd

==2354== Invalid free() / delete / delete[]
==2354== at 0x1B90513F: operator delete(void*) (vg_replace_malloc.c:156)
==2354== by 0x1C1AD28F: garbage_collect (vio.cpp:3338)
==2354== by 0x1C1AEF57: purge (vio.cpp:4318)
==2354== by 0x1C1B08A9: VIO_chase_record_version (vio.cpp:861)
==2354== by 0x1C1B4296: VIO_get (vio.cpp:1672)
==2354== by 0x1C2917FA: get_record(tdbb*, Rsb*, Rsb*, rse_get_mode)
(rse.cpp:2302)
==2354== by 0x1C2920A9: get_record(tdbb*, Rsb*, Rsb*, rse_get_mode)
(rse.cpp:2583)
==2354== by 0x1C293F63: RSE_get_record(tdbb*, Rsb*, rse_get_mode)
(rse.cpp:478)
==2354== by 0x1C26B9CD: looper (exe.cpp:1959)
==2354== by 0x1C26DDB2: EXE_send (exe.cpp:1355)
==2354== by 0x1C180C26: jrd8_start_and_send (jrd.cpp:3626)
==2354== by 0x1C17610F: isc_start_and_send (why.cpp:4520)
==2354== by 0x1C298B56: METD_get_relation (metd.cpp:2359)
==2354== by 0x1C1D9565: PASS1_make_context (pass1.cpp:303)
==2354== by 0x1C1DB029: PASS1_statement (pass1.cpp:4010)
==2354== by 0x1C1BC741: prepare (dsql.cpp:4363)
==2354== by 0x1C1BE577: dsql8_prepare (dsql.cpp:1464)
==2354== by 0x1C179721: isc_dsql_prepare_m (why.cpp:3255)
==2354== by 0x1C1799DA: isc_dsql_prepare (why.cpp:3174)
==2354== by 0x1C15EBE1:
ibpp_internals::StatementImpl::Prepare(std::string const&)
(statement.cpp:102)
==2354== Address 0x1BC03974 is 5492 bytes inside a block of size 16384 alloc'd
==2354== at 0x1B904A80: malloc (vg_replace_malloc.c:131)
==2354== by 0x1C2B6C1C:
Firebird::MemoryPool::external_alloc(unsigned) (alloc.cpp:114)
==2354== by 0x1C2B7DEB:
Firebird::MemoryPool::internal_create(unsigned, int*, int*)
(alloc.cpp:263)
==2354== by 0x1C23A235: JrdMemoryPool::createPool() (all.cpp:118)
==2354== by 0x1C253C3A: CMP_compile2(tdbb*, unsigned char*,
unsigned short) (cmp.cpp:566)
==2354== by 0x1C183378: jrd8_compile_request (jrd.cpp:1700)
==2354== by 0x1C17CBC4: isc_compile_request (why.cpp:1157)
==2354== by 0x1C298B13: METD_get_relation (metd.cpp:2356)
==2354== by 0x1C1D9565: PASS1_make_context (pass1.cpp:303)
==2354== by 0x1C1DB029: PASS1_statement (pass1.cpp:4010)
==2354== by 0x1C1BC741: prepare (dsql.cpp:4363)
==2354== by 0x1C1BE577: dsql8_prepare (dsql.cpp:1464)
==2354== by 0x1C179721: isc_dsql_prepare_m (why.cpp:3255)
==2354== by 0x1C1799DA: isc_dsql_prepare (why.cpp:3174)
==2354== by 0x1C15EBE1:
ibpp_internals::StatementImpl::Prepare(std::string const&)
(statement.cpp:102)
==2354== by 0x1C091040:
SimoObject::PrepareInsertAttrs(IBPP::Ptr<IBPP::IStatement>&,
std::string&, std::string&) (SimoObject.cc:422)
==2354== by 0x1C068A5B: SimoPerson::Add() (Person.cc:334)