Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite: fix coverity warnings related to backup() #56961

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading