Free memory for a fetch array

does not release resources for the sqlda structure. When your application no longer needs the sqlda structure, it must free all memory that it uses.

The sample program calls the free_sqlda() function to free the memory that the sqlda structure uses.
/**********************************************************************
* Function: free_sqlda
* Purpose: Frees memory used by sqlda. This memory includes:
* o loc_buffer memory (used by TEXT & BYTE)
* o sqldata memory
* o sqlda structure
**********************************************************************/
void free_sqlda(struct sqlda *sqlda)
{
    int i,j, num_to_dealloc;
    struct sqlvar_struct *col_ptr;
    ifx_loc_t *temp_loc;

    for (i = 0, col_ptr = sqlda->sqlvar; i < sqlda->sqld; i++, 
    col_ptr++)
    {
   if ( col_ptr->sqltype == CLOCATORTYPE )
       {
      /* Free memory for blob buffer of each element in fetch array */
      num_to_dealloc = (FetArrSize == 0)? 1: FetArrSize;
      temp_loc = (ifx_loc_t *) col_ptr->sqldata;
      for (j = 0; j< num_to_dealloc; j++, temp_loc++)
       {
          free(temp_loc->loc_buffer);
       }
       }
   /* Free memory for sqldata (contains fetch array) */
   free(col_ptr->sqldata);
    }

    /* Free memory for sqlda structure */
    free(sqlda);
}