Subject Re: [firebird-support] Firebird C API: release resource
Author Ivan Prenosil
> Hi,
> Below codes are from borland interbase apiguide.pdf:
> .........
> XSQLDA *isqlda, *osqlda;
> .....
> .....
> osqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(2);
> osqlda->version = SQLDA_CURRENT_VERSION;
> osqlda->sqln = 2;
> isc_dsql_prepare(status_vector,&tr_handle, &stmt_handle, 0, str, 1,
> osqlda);
> if (status_vector[0] == 1 && status_vector[1]) {
> isc_print_status(status_vector);
> return(1); <-------------------
> }
> --
>
> Is it necessary that releasing the osqlda before the funciton return?
>
> like so:
>
> if (status_vector[0] == 1 && status_vector[1]) {
> isc_print_status(status_vector);
> FREE(osqlda); <----------------------
> return(1); <----------------------
> }

Yes.

Ivan