Skip to content

Commit

Permalink
prevent an assert() in sqldb_rollback() if sqldb_begin() failed to ob…
Browse files Browse the repository at this point in the history
…tain writelock
  • Loading branch information
ksmurchison authored and rjbs committed Sep 18, 2024
1 parent c75865d commit ae55cbe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/sqldb.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@ EXPORTED int sqldb_commit(sqldb_t *open, const char *name)

EXPORTED int sqldb_rollback(sqldb_t *open, const char *name)
{
if (!open->writelock) return 0;

assert(open->trans.count);
char *prev = strarray_pop(&open->trans);
if (name) assert(!strcmp(prev, name));
Expand Down

0 comments on commit ae55cbe

Please sign in to comment.