Skip to content

Commit

Permalink
Fix a failure-path memory leak in PatchDB (surge-synthesizer#5269)
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul authored Oct 17, 2021
1 parent bc65649 commit 6e464c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/common/PatchDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,13 @@ CREATE TABLE IF NOT EXISTS Favorites (
// clean up all the prepared statements
if (dbh)
sqlite3_close(dbh);
dbh = nullptr;
}

if (rodbh)
{
sqlite3_close(rodbh);
rodbh = nullptr;
}
}

Expand Down Expand Up @@ -973,6 +980,8 @@ CREATE TABLE IF NOT EXISTS Favorites (
<< "'. The error was '" << sqlite3_errmsg(dbh) << "'.";
storage->reportError(oss.str(), "Surge Patch Database Error");
}
if (rodbh)
sqlite3_close(rodbh);
rodbh = nullptr;
}
}
Expand Down

0 comments on commit 6e464c6

Please sign in to comment.