Skip to content

Commit

Permalink
src: resolve issues reported by coverity
Browse files Browse the repository at this point in the history
The specific issues raised by Coverity are:

** CID 182716:  Control flow issues  (DEADCODE)
/src/node_file.cc: 1192
>>> CID 182716:  Control flow issues  (DEADCODE)
>>> Execution cannot reach this statement:
    "args->GetReturnValue().Set(...".

** CID 182715:  Uninitialized members  (UNINIT_CTOR)
/src/node_file.h: 29
>>> CID 182715:  Uninitialized members  (UNINIT_CTOR)
>>> Non-static class member "syscall_" is not initialized in this
    constructor nor in any functions that it calls.

PR-URL: #18629
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
cjihrig authored and BridgeAR committed Feb 10, 2018
1 parent 1729af2 commit 2870867
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1192,13 +1192,9 @@ static void OpenFileHandle(const FunctionCallbackInfo<Value>& args) {
req_wrap->SetReturnValue(args);
} else {
SYNC_CALL(open, *path, *path, flags, mode)
if (SYNC_RESULT < 0) {
args.GetReturnValue().Set(SYNC_RESULT);
} else {
HandleScope scope(env->isolate());
FileHandle* fd = new FileHandle(env, SYNC_RESULT);
args.GetReturnValue().Set(fd->object());
}
HandleScope scope(env->isolate());
FileHandle* fd = new FileHandle(env, SYNC_RESULT);
args.GetReturnValue().Set(fd->object());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/node_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FSReqBase : public ReqWrap<uv_fs_t> {

private:
enum encoding encoding_ = UTF8;
const char* syscall_;
const char* syscall_ = nullptr;

const char* data_ = nullptr;
MaybeStackBuffer<char> buffer_;
Expand Down

0 comments on commit 2870867

Please sign in to comment.