CESNET / libnetconf

C NETCONF library
Other
113 stars 83 forks source link

Address a few more cppcheck complaints #280

Closed adamjrichter closed 5 years ago

adamjrichter commented 5 years ago

Thank you for merging my previous pull request so quickly, Michal. Here are a few more attempted clean-ups of complaints from cppcheck:

src/datastore.c: minor memory leaks in error branches src/internal.c: potential memory corruption (one byte, unlikely) src/transport.c: "%d" should be "%u" in a format string src/session.c: possible null pointer dereference src/datastore/edit_config.c: remove two redundant "if" tests.

As with my previous pull request, although I have inspected the changes visually, built with the changes and confirmed that I did not see any compiler warnings related to the changes, I have not attempted to run the code, but I will be happy to respond to any questions.

Thanks for considering this patch submission.

michalvasko commented 5 years ago

Hi, it seems fine and since libnetconf is a legacy code now, it can be mregd if you are using it successfully this way.

Regards, Michal

adamjrichter commented 5 years ago

Thank you for your prompt review and merge!

To clarify, I do not run this code. I just know that it successfully built and that cppcheck stopped complaining. I think that even if you are concerned about code churn for code that might not be the priority of your development community, I (of course) think you made the right choice to merge it, especially considering that a couple of at least one or two of the changes might fix actual malfunctions (memory corruption and null pointer dereference), however unlikely they may have been.

So, thank you for merging my change. I probably won't have occasion to submit further changes to this legacy code, but, if I do, I will take a closer look trying actually run the changed code.