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

Cppcheck #49

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

charlesUnixPro
Copy link
Contributor

Fix 'cppcheck' errors; add two va_end() calls on error exit.

@thefallentree
Copy link
Contributor

+1

Copy link
Contributor

@thefallentree thefallentree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, because va2 is not va_started , so it doesn't need to be va_end-ed.

Copy link
Contributor

@Shea690901 Shea690901 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excerpt from man va_copy:

Each invocation of va_copy() must be matched by a corresponding invocation of va_end() in the same function.

So this change is needed, but it is missing the va_end(va) for the original va_start(va)...

@@ -1482,6 +1482,7 @@ int telnet_vprintf(telnet_t *telnet, const char *fmt, va_list va) {
if (output == 0) {
_error(telnet, __LINE__, __func__, TELNET_ENOMEM, 0,
"malloc() failed: %s", strerror(errno));
va_end(va2);
Copy link
Contributor

@Shea690901 Shea690901 May 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing va_end(va);
The same with the change further down....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants