-
Notifications
You must be signed in to change notification settings - Fork 328
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
Fixes from Coverity Report (12/01/2017) #66
base: master
Are you sure you want to change the base?
Changes from all commits
2ee3265
676ab95
ec6cdeb
858cb4d
9173b78
a67463b
d28a21b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks valid, assuming that we can go
and then if (nxt_buf_is_mem(b)) { can be |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps not too surprisingly this code no longer exists. nxt_mp_create() is no longer called and was removed by
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and as such is no longer flagged by coverity... |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,11 +116,6 @@ nxt_process_arguments(nxt_task_t *task, char **orig_argv, char ***orig_envp) | |
} | ||
} | ||
|
||
p = nxt_malloc(strings_size); | ||
if (p == NULL) { | ||
return; | ||
} | ||
|
||
if (argv_end == end) { | ||
/* | ||
* There is no reason to modify environ if arguments | ||
|
@@ -130,6 +125,11 @@ nxt_process_arguments(nxt_task_t *task, char **orig_argv, char ***orig_envp) | |
goto done; | ||
} | ||
|
||
p = nxt_malloc(strings_size); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you move That is, consider you jump to |
||
if (p == NULL) { | ||
goto done; | ||
} | ||
|
||
end = argv[0]; | ||
|
||
for (i = 0; argv[i] != NULL; i++) { | ||
|
@@ -149,7 +149,7 @@ nxt_process_arguments(nxt_task_t *task, char **orig_argv, char ***orig_envp) | |
|
||
env = nxt_malloc(environ_size); | ||
if (env == NULL) { | ||
return; | ||
goto done; | ||
} | ||
|
||
/* | ||
|
@@ -178,6 +178,12 @@ nxt_process_arguments(nxt_task_t *task, char **orig_argv, char ***orig_envp) | |
} | ||
|
||
done: | ||
if (p != NULL) { | ||
nxt_free(p); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, I just saw this old PR around, and had a fast look at it. nxt_free(), as well as free(3), can handle NULL just fine. The conditionals are not necessary. |
||
} | ||
if (env != NULL) { | ||
nxt_free(env); | ||
} | ||
|
||
/* Preserve space for the trailing zero. */ | ||
end--; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still looks valid, though likely has a pretty slim chance of triggering due to
and we only possibly take the problematic code path if we are using nxt_event_conn_io_sendbuf().