[ruby-oci8-commit] [503] trunk/ruby-oci8: fix core dump.

nobody at rubyforge.org nobody at rubyforge.org
Tue Apr 17 11:15:49 UTC 2012


Revision: 503
Author:   kubo
Date:     2012-04-17 11:15:49 +0000 (Tue, 17 Apr 2012)
Log Message:
-----------
fix core dump.
See: https://github.com/kubo/ruby-oci8/issues/11

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/oci8lib.c

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2012-04-08 11:32:55 UTC (rev 502)
+++ trunk/ruby-oci8/ChangeLog	2012-04-17 11:15:49 UTC (rev 503)
@@ -1,3 +1,8 @@
+2012-04-17  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/oci8lib.c: fix core dump.
+	    See: https://github.com/kubo/ruby-oci8/issues/11
+	    (reported by Raimonds Simanovskis)
+
 2012-04-08  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/lob.c, ext/oci8/win32.c, lib/oci8/oracle_version.rb:
 	    revise rdoc comments.

Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8lib.c	2012-04-08 11:32:55 UTC (rev 502)
+++ trunk/ruby-oci8/ext/oci8/oci8lib.c	2012-04-17 11:15:49 UTC (rev 503)
@@ -37,10 +37,15 @@
     oci8_unlink_from_parent(base);
     if (base->vptr->free != NULL)
         base->vptr->free(base);
-    if (base->type >= OCI_DTYPE_FIRST)
+    if (base->type >= OCI_DTYPE_FIRST) {
         OCIDescriptorFree(base->hp.ptr, base->type);
-    else if (base->type >= OCI_HTYPE_FIRST)
+    } else if (base->type == OCI_HTYPE_BIND || base->type == OCI_HTYPE_DEFINE) {
+        ; /* Do nothing. Bind handles and define handles are freed when
+           * associating statement handles are freed.
+           */
+    } else if (base->type >= OCI_HTYPE_FIRST) {
         OCIHandleFree(base->hp.ptr, base->type);
+    }
     base->type = 0;
     base->hp.ptr = NULL;
 }



More information about the ruby-oci8-commit mailing list