[asterisk-dev] cdr_odbc.c is broken in trunk

Nick Gorham nick at lurcher.org
Thu Jan 10 05:18:03 CST 2008


Hi,

The change to use prepare_cb() in odbc_log became broken in r88182.

The code calls SQLBindParameter on a local variable (timestr) but as it 
now doesn't call SQLExecute in the same function when it finally gets to 
SQLExecute that variable is out of scope.

I dont know if I can pass attachments to this list, so the fixed cdr can 
be found here http://www.lurcher.org/~nick/cdr_odbc.c

The code contained the following lines

        /* We really should only have to do this once.  But for some
         * strange reason if I don't it blows holes in memory like
         * like a shotgun.  So we just do this so its safe.
         */

The "strange reason", as I have tried to report several times now via 
the forum, is that the memory passed to SQLBindParameter is not 
referenced until the SQLExecute, that the point of binding parameters, 
you pass the address of the storage, then before the SQLExecute you set 
the values you intend to use.

-- 
Nick Gorham
Easysoft and unixODBC




More information about the asterisk-dev mailing list