Skip to content

Commit 9e60501

Browse files
cjihrigtargos
authored andcommitted
sqlite: fix coverity warnings related to backup()
This commit fixes several coverity warnings related to the recently landed backup() API. PR-URL: #56961 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 6b398d6 commit 9e60501

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/node_sqlite.cc

+12-6
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ class BackupJob : public ThreadPoolWork {
171171
env_(env),
172172
source_(source),
173173
pages_(pages),
174-
source_db_(source_db),
175-
destination_name_(destination_name),
176-
dest_db_(dest_db) {
174+
source_db_(std::move(source_db)),
175+
destination_name_(std::move(destination_name)),
176+
dest_db_(std::move(dest_db)) {
177177
resolver_.Reset(env->isolate(), resolver);
178178
progressFunc_.Reset(env->isolate(), progressFunc);
179179
}
@@ -314,7 +314,7 @@ class BackupJob : public ThreadPoolWork {
314314
sqlite3* dest_ = nullptr;
315315
sqlite3_backup* backup_ = nullptr;
316316
int pages_;
317-
int backup_status_;
317+
int backup_status_ = SQLITE_OK;
318318
std::string source_db_;
319319
std::string destination_name_;
320320
std::string dest_db_;
@@ -1078,8 +1078,14 @@ void Backup(const FunctionCallbackInfo<Value>& args) {
10781078

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

1081-
BackupJob* job = new BackupJob(
1082-
env, db, resolver, source_db, *dest_path, dest_db, rate, progressFunc);
1081+
BackupJob* job = new BackupJob(env,
1082+
db,
1083+
resolver,
1084+
std::move(source_db),
1085+
*dest_path,
1086+
std::move(dest_db),
1087+
rate,
1088+
progressFunc);
10831089
db->AddBackup(job);
10841090
job->ScheduleBackup();
10851091
}

0 commit comments

Comments
 (0)