waliwali / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

Reference counting errors #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Numerous reference counting errors in the _python_ibm_db_bind_fetch_helper 
in ibm_db.c can result in the interpreter crashing when the reference 
count on None drops to zero, and cause all values retrieved to be leaked 
(because their reference counts will never reach zero). Problem is present 
in 0.3.0 and 0.2.9 (and presumably earlier versions).

The attached patch against SVN trunk should fix the reference counts in 
that function (there may be other reference counting errors, but I haven't 
checked extensively yet). The patch also cleans up the function by 
consolidating all the op parameter checks (FETCH_ASSOC / INDEX / BOTH) at 
the end of the loop, and fixes a potential SIGSEGV bug (memset was called 
immediately after a malloc before checking the malloc result - the memset 
was redundant anyway, as the buffer is automatically NULL-terminated by 
the SQLGetData function called later).

Original issue reported on code.google.com by wavefor...@gmail.com on 27 Sep 2008 at 2:04

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by abhigyan...@in.ibm.com on 29 Sep 2008 at 3:54

GoogleCodeExporter commented 9 years ago
Thanks for the patch Dave, I am working on this.

Original comment by abhigyan...@in.ibm.com on 7 Oct 2008 at 1:31

GoogleCodeExporter commented 9 years ago
fixed in 0.4.0. Once again thanks for the patch. :)
Please have a look at new release.

Original comment by abhigyan...@in.ibm.com on 8 Oct 2008 at 6:26