Skip to content

[WIP] bugfix: sol, isol: Address two memory leaks (etc) #63

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

pstrinkle
Copy link
Contributor

Addresses two memory leaks. Before fixing each leak, I fixed the style within that specific method. If you approve of the style changes in a different PR, I can start applying that more liberally.

lib/ipmi_sol.c Outdated
/* ERROR */
perror("select");
free(buffer);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure if they needed to explicitly leave raw mode before exiting -- if so, this can be added here, or this can jump to a cleanup label.

@pstrinkle pstrinkle changed the title Address two memory leaks bugfix: Address two memory leaks Nov 26, 2018
@pstrinkle pstrinkle changed the title bugfix: Address two memory leaks bugfix: lib/ipmi_isol/ipmi_sol: Address two memory leaks Nov 27, 2018
@pstrinkle pstrinkle changed the title bugfix: lib/ipmi_isol/ipmi_sol: Address two memory leaks bugfix: sol, isol: Address two memory leaks (etc) Nov 29, 2018
@pstrinkle
Copy link
Contributor Author

Alexander, fixed the static bit on these two files. Other cleanup while I had it open.

Cleanup style and whitespace via clang-format-6.0.

Signed-off-by: Patrick Venture <venture@google.com>
The buffer is allocated, and used and then not freed.

Signed-off-by: Patrick Venture <venture@google.com>
_in_raw_mode in lib/ipmi_isol.c is used as a boolean
therefore use a bool type.

Signed-off-by: Patrick Venture <venture@google.com>
Use the currently defined ipmi return code macro
values.

Signed-off-by: Patrick Venture <venture@google.com>
Use boolean types for boolean variables and not
ints.

Signed-off-by: Patrick Venture <venture@google.com>
Cleanup whitespace and style via clang-format-6.0.

Signed-off-by: Patrick Venture <venture@google.com>
The buffer is allocated, and used and then not freed.

Signed-off-by: Patrick Venture <venture@google.com>
Convert _use_sol_for_keepalive from int to bool.
The int is treated as a bool, therefore make it
one.

Signed-off-by: Patrick Venture <venture@google.com>
Convert int _in_raw_mode to bool as it is used as
one.

Signed-off-by: Patrick Venture <venture@google.com>
Convert int _disable_keepalive to bool as it is
used as such.

Signed-off-by: Patrick Venture <venture@google.com>
Use bool for enable parameter.  It is initially set
to -1, which is true for boolean checks.

Signed-off-by: Patrick Venture <venture@google.com>
Remove extraneous parentheses from negative value
return statements.

Signed-off-by: Patrick Venture <venture@google.com>
Use IPMI_CC_OK macro for ccode of 0 to avoid magic
numbers.

Signed-off-by: Patrick Venture <venture@google.com>
Use boolean type for variables that are used as
booleans.

Signed-off-by: Patrick Venture <venture@google.com>
The static keyword and return value for a method should be on their own
lines per the style guide.

Signed-off-by: Patrick Venture <venture@google.com>
The static keyword and function return values must be on their own lines
per the style guide.

Signed-off-by: Patrick Venture <venture@google.com>
Use boolean type variables in processiSolUserInput instead of treating
ints as bools.

Signed-off-by: Patrick Venture <venture@google.com>
Use a boolean parameter instead of an int for suspendSelf.

Signed-off-by: Patrick Venture <venture@google.com>
Use a boolean parameter in suspendSelf instead of int.

Signed-off-by: Patrick Venture <venture@google.com>
Use boolean variable types in processSolUserInput instead of treating
ints as bools.

Signed-off-by: Patrick Venture <venture@google.com>
try is a keyword in c++, and not c, however, it's generally preferred to
avoid using keywords for variable names.  Therefore, rename the variable
try to try_count.

Signed-off-by: Patrick Venture <venture@google.com>
Swap calls to free() with calls to free_n() to leverage helper method
and handle clearing pointers after freeing in one step.

Signed-off-by: Patrick Venture <venture@google.com>
Swap calls to free() with calls to free_n() to leverage helper method
and handle clearing pointers after freeing in one step.

Signed-off-by: Patrick Venture <venture@google.com>
@pstrinkle
Copy link
Contributor Author

There are some memory leak bugfixes here, and then some reworked pieces as you desired. However, it does have a lot of the automated whitespace cleanup. I can spend a bit and rebase all the patches and exclude the whitespace fix patches.

@pstrinkle pstrinkle changed the title bugfix: sol, isol: Address two memory leaks (etc) [WIP] bugfix: sol, isol: Address two memory leaks (etc) Feb 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant