mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 05:55:59 +03:00
statedb: Make sure we call sqlite3_close on a valid pointer.
This commit is contained in:
parent
47b436c279
commit
8f7900ee8f
1 changed files with 7 additions and 6 deletions
|
@ -146,10 +146,10 @@ int csync_statedb_load(CSYNC *ctx, const char *statedb, sqlite3 **pdb) {
|
|||
int rc = -1;
|
||||
c_strlist_t *result = NULL;
|
||||
char *statedb_tmp = NULL;
|
||||
sqlite3 *db;
|
||||
sqlite3 *db = NULL;
|
||||
|
||||
if (_csync_statedb_check(statedb) < 0) {
|
||||
rc = -1;
|
||||
rc = _csync_statedb_check(statedb);
|
||||
if (rc < 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -159,13 +159,14 @@ int csync_statedb_load(CSYNC *ctx, const char *statedb, sqlite3 **pdb) {
|
|||
* The intention is that if something goes wrong we will not loose the
|
||||
* statedb.
|
||||
*/
|
||||
if (asprintf(&statedb_tmp, "%s.ctmp", statedb) < 0) {
|
||||
rc = asprintf(&statedb_tmp, "%s.ctmp", statedb);
|
||||
if (rc < 0) {
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (c_copy(statedb, statedb_tmp, 0644) < 0) {
|
||||
rc = -1;
|
||||
rc = c_copy(statedb, statedb_tmp, 0644);
|
||||
if (rc < 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue