From 9fe01bd90b108f41cef85f3ef83d8c1bb88bdc66 Mon Sep 17 00:00:00 2001 From: Anthony Tuininga Date: Thu, 12 Jan 2017 11:49:28 -0700 Subject: [PATCH] Clear the object prior to fetching; otherwise, OCI will try to do something with it and potentially crash the application! --- ObjectVar.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ObjectVar.c b/ObjectVar.c index a37031f..7688ca1 100644 --- a/ObjectVar.c +++ b/ObjectVar.c @@ -225,10 +225,13 @@ static int ObjectVar_PreFetch( ub4 i; for (i = 0; i < var->allocatedElements; i++) { - Py_CLEAR(var->objects[i]); - if (var->data[i]) + if (var->objects[i]) + Py_CLEAR(var->objects[i]); + else if (var->data[i]) OCIObjectFree(var->environment->handle, var->environment->errorHandle, var->data[i], OCI_DEFAULT); + var->data[i] = NULL; + var->objectIndicator[i] = NULL; } return 0;