mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
wasi: remove unecessary null check
As reported by coverity the null check is done after earlier code has already derefenced options.envp. Either we should null check earlier uses or this check is not necessary. Since options.envp is created with new which should throw an exception intead of returning null, it should be safe to assume the null check is not required. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: https://github.com/nodejs/node/pull/42819 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
1 parent
7a7491a8c2
commit
bbbc54f8d4
1 file changed
+3
-5
+3
-5
@@ -236,11 +236,9 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
|
||||
delete[] options.argv;
|
||||
}
|
||||
|
||||
if (options.envp != nullptr) {
|
||||
for (uint32_t i = 0; options.envp[i]; i++)
|
||||
free(const_cast<char*>(options.envp[i]));
|
||||
delete[] options.envp;
|
||||
}
|
||||
for (uint32_t i = 0; options.envp[i]; i++)
|
||||
free(const_cast<char*>(options.envp[i]));
|
||||
delete[] options.envp;
|
||||
|
||||
if (options.preopens != nullptr) {
|
||||
for (uint32_t i = 0; i < options.preopenc; i++) {
|
||||
|
||||
Reference in new issue
Block a user