Skip to content

Commit

Permalink
sqlite: fix coverity warnings related to backup()
Browse files Browse the repository at this point in the history
This commit fixes several coverity warnings related to the
recently landed backup() API.

PR-URL: #56961
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and targos committed Feb 11, 2025
1 parent 6b398d6 commit 9e60501
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ class BackupJob : public ThreadPoolWork {
env_(env),
source_(source),
pages_(pages),
source_db_(source_db),
destination_name_(destination_name),
dest_db_(dest_db) {
source_db_(std::move(source_db)),
destination_name_(std::move(destination_name)),
dest_db_(std::move(dest_db)) {
resolver_.Reset(env->isolate(), resolver);
progressFunc_.Reset(env->isolate(), progressFunc);
}
Expand Down Expand Up @@ -314,7 +314,7 @@ class BackupJob : public ThreadPoolWork {
sqlite3* dest_ = nullptr;
sqlite3_backup* backup_ = nullptr;
int pages_;
int backup_status_;
int backup_status_ = SQLITE_OK;
std::string source_db_;
std::string destination_name_;
std::string dest_db_;
Expand Down Expand Up @@ -1078,8 +1078,14 @@ void Backup(const FunctionCallbackInfo<Value>& args) {

args.GetReturnValue().Set(resolver->GetPromise());

BackupJob* job = new BackupJob(
env, db, resolver, source_db, *dest_path, dest_db, rate, progressFunc);
BackupJob* job = new BackupJob(env,
db,
resolver,
std::move(source_db),
*dest_path,
std::move(dest_db),
rate,
progressFunc);
db->AddBackup(job);
job->ScheduleBackup();
}
Expand Down

0 comments on commit 9e60501

Please sign in to comment.