sqlfree() — Deallocate Dynamic Memory

Deallocates the memory for a column data component that sqlalloc() previously allocates.

This function returns normalized values. For more information, see the function return values in the "General Diagnostics" section in this chapter:

SYNTAX
int
sqlfree ( pmem )
  char  *pmem;  /* INPUT-OUTPUT */ 

pmem

A pointer to memory that sqlalloc() previously allocates.

NOTES

CAUTION: Do not deallocate the same block of memory more than once. This can cause a memory violation. Do not attempt to call sqlalloc() with any value for pmem other than what sqlalloc() returns. This causes unpredictable behavior.
EXAMPLE

This example deallocates the memory for the data elements in a column to which psqlvar refers:

#include "proesql.h"
struct SQLVAR_T *psqlvar;
            .
            .
            .
sqlfree(psqlvar->DATA);
psqlvar->DATA = (char *) 0;
if (psqlvar->INDICATOR)
{
    /* Free storage for NULL value indicators if allocated. */  
    sqlfree(psqlvar->INDICATOR);
    psqlvar->INDICATOR = (long *) 0;
} 

SEE ALSO

sqlalloc() — Allocate Dynamic Memory, sqldld() — Deallocate Dynamic Descriptor Area, proesql.h


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095