SQLBOX_FREE(3) Library Functions Manual SQLBOX_FREE(3)

sqlbox_freefrees sqlbox context

library “sqlbox”

#include <stdint.h>
#include <sqlbox.h>

void
sqlbox_free(struct sqlbox *box);

Shuts down box by closing the box communication channel and releasing memory. When the box channel closes, it will finalise databases' open statements, roll back databases' transactions, close open databases, and release memory. This does not free any of the sqlbox_cfg memory passed to sqlbox_alloc(3).

If box is NULL, does nothing. The box should not be used subsequent this function.

This trivial example allocates then frees a context.

struct sqlbox *p;
struct sqlbox_cfg cfg;

memset(&cfg, 0, sizeof(struct sqlbox_cfg));

if ((p = sqlbox_alloc(&cfg)) == NULL)
  errx(EXIT_FAILURE, "sqlbox_alloc");

sqlbox_free(p);

sqlbox_alloc(3)

December 2, 2023 OpenBSD 7.4