KSQL_FREE(3) Library Functions Manual KSQL_FREE(3)

ksql_free
free a ksql database handle

library “ksql”

#include <sys/types.h>
#include <stdint.h>
#include <ksql.h>
enum ksqlc
ksql_free(struct ksql *sql);

The ksql_free function frees a database handle sql, previously allocated with ksql_alloc(3). This internally invokes ksql_close(3) then frees all internal memory. If the handle was allocated with KSQL_SAFE_EXIT, the handle is removed from the queue of handles that would be freed on exit (so it is not double-freed).
If sql is NULL, no action occurs.
This function is invoked from the atexit(3) handler if KSQL_SAFE_EXIT was specified and the handle was not freed prior to exiting. In this case, the KSQL_EXIT_ON_ERR flag is temporarily suppressed.

This returns the error code of ksql_close(3).
April 5, 2018 OpenBSD 6.4