---
name: "odbx_result_finish"
section: "3"
platform: "linux"
package: "opendbx"
version: "1.4.6-13"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/odbx_result_finish"
---

# odbx\_result\_finish(3)

Closes the result set and frees its allocated memory

## NAME

odbx\_result\_finish, odbx\_result\_free - Closes the result set and frees its allocated memory

## SYNOPSIS

```
FC#include <opendbx/api.h>F[0]
```

FCint **odbx\_result\_finish**F\[0\]  FC(odbx\_result\_t\* *result*);F\[0\]

FCvoid **odbx\_result\_free**F\[0\]  FC(odbx\_result\_t\* *result*);F\[0\]

## DESCRIPTION

FC**odbx\_result\_finish**F\[0\]() closes the result set which may also include dropping the non-fetched rows sent by the server. It releases all resources allocated by FC**odbx\_result**F\[0\]() and by the native database library which are attached to FCresultF\[0\] as well as the memory the first parameter is pointing to. Trying to free FCresultF\[0\] manually using free() will create memory leaks because it contains more dynamically allocated structures and also the memory of the result set allocated by the native database library. FC**odbx\_result\_finish**F\[0\]() must be called even if the statement was not a SELECT-like statement which returned now rows as it may be necessary to commit the changes done by the statement.

FC**odbx\_result\_free**F\[0\]() performs the same tasks as FC**odbx\_result\_finish**F\[0\]() but is unable to return an error if the task couln't be completed. It shouldn't be used in applications linking to the OpenDBX library version 1.3.8 or later and it will be removed from the library at a later stage.

FCresultF\[0\] must be valid a result set created by FC**odbx\_result**F\[0\]() which is returned via its second parameter. After feeding it to FC**odbx\_result\_finish**F\[0\]() it becomes invalid and must not be feed to it again. Otherwise a "double free" may occur and the application may be terminated.

## RETURN VALUE

FC**odbx\_result\_finish**F\[0\]() returns FCODBX\_ERR\_SUCCESSF\[0\], or an error code whose value is less than zero if one of the operations couldn't be completed successfully. Possible error codes are listed in the error section and they can be feed to FC**odbx\_error**F\[0\]() and FC**odbx\_error\_type**F\[0\]() to get further details.

## ERRORS

- \-FCODBX\_ERR\_BACKENDF\[0\]

  The native database library returned an error

- \-FCODBX\_ERR\_PARAMF\[0\]

  The FCresultF\[0\] parameter is invalid

## SEE ALSO

FC**odbx\_result**F\[0\]()
