-
Notifications
You must be signed in to change notification settings - Fork 133
Cppcheck #49
base: develop
Are you sure you want to change the base?
Cppcheck #49
Conversation
+1 |
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.
actually, because va2 is not va_started , so it doesn't need to be va_end-ed.
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.
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); |
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.
Missing va_end(va);
The same with the change further down....
Fix 'cppcheck' errors; add two va_end() calls on error exit.