Skip to content

Commit

Permalink
oracle plugin: Fix a memory leak.
Browse files Browse the repository at this point in the history
Parameters must be freed using OCIDescriptorFree. D'oh!

Thanks to Rena Vetterling for helping me hunt down this problem!

Change-Id: Ic374ae13085c8d2afbdf9a3c0ceef92b485e7723
  • Loading branch information
octo committed Jan 21, 2012
1 parent f6fa5e1 commit 7746033
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/oracle.c
Expand Up @@ -568,11 +568,15 @@ static int o_read_database_query (o_database_t *db, /* {{{ */
&column_name, &column_name_length, OCI_ATTR_NAME, oci_error);
if (status != OCI_SUCCESS)
{
OCIDescriptorFree (oci_param, OCI_DTYPE_PARAM);
o_report_error ("o_read_database_query", "OCIAttrGet (OCI_ATTR_NAME)",
oci_error);
continue;
}

OCIDescriptorFree (oci_param, OCI_DTYPE_PARAM);
oci_param = NULL;

/* Copy the name to column_names. Warning: The ``string'' returned by OCI
* may not be null terminated! */
memset (column_names[i], 0, DATA_MAX_NAME_LEN);
Expand Down Expand Up @@ -750,6 +754,7 @@ static int o_shutdown (void) /* {{{ */
}

OCIHandleFree (oci_env, OCI_HTYPE_ENV);
oci_env = NULL;

udb_query_free (queries, queries_num);
queries = NULL;
Expand Down

0 comments on commit 7746033

Please sign in to comment.