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

rauc-installer: refactoring and bug fixes #66

Merged
merged 5 commits into from
Jan 5, 2021

Conversation

Bastian-Krause
Copy link
Member

This is the fourth of a series of PRs to refactor and clean up the code base, get rid of bugs (memory leaks, use-after-frees, race conditions), simplify functions and document them.

In this iteration I focused on the rauc-installer module.

src/rauc-installer.c Outdated Show resolved Hide resolved
src/rauc-installer.c Outdated Show resolved Hide resolved
g_autoptr(GError) error = NULL;
struct install_context *context = NULL;

g_return_val_if_fail(data, NULL);
Copy link
Member

Choose a reason for hiding this comment

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

nit: in the other commits you simply did g_return_val_if_fail(context) which is inconsistent with this one.

Clean and improve this function:
- update rauc installer doc reference
- sanity check input arguments
- fix leaking message with g_autofree (g_variant_lookup() copies the
  string, see [1])
- make error output warning log output
- wrap long lines
- separate nested function calls
- perform empty queue check under lock
- remove unused depth variable, pass NULL instead

[1] https://developer.gnome.org/glib/stable/gvariant-format-strings.html#gvariant-format-strings-strings

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Clean and improve this function:
- update rauc installer doc reference
- sanity check input argument
- simplify if condition

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Clean and improve this function:
- simplify if condition

Signed-off-by: Bastian Krause <bst@pengutronix.de>
@Bastian-Krause
Copy link
Member Author

Force-pushed:

  • wrap lines > 100 characters
  • remove accidental double loop context unref in progress_msg()
  • remove unneeded temporary variables

Clean and improve this function:
- use g_autoptr for error
- sanity check input argument
- wrap long lines
- turn g_printerr() into g_warning() to make use of logging
- clear RInstaller pointer
- do not call g_signal_handlers_disconnect_by_data() with NULL pointer
  instance if proxy creation failed (goto later notify_complete label
  instead)

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Clean and improve this function:
- remove duplicate doc string
- wrap long lines
- sanity check input arguments

Signed-off-by: Bastian Krause <bst@pengutronix.de>
@Bastian-Krause
Copy link
Member Author

Added to commit "rauc-installer: refactor install_loop_thread()":

  • do not call g_signal_handlers_disconnect_by_data() with NULL pointer instance if proxy creation failed (goto later notify_complete label instead)

@prevas-lkmi prevas-lkmi merged commit f658874 into rauc:master Jan 5, 2021
Bastian-Krause added a commit to Bastian-Krause/rauc-hawkbit-updater that referenced this pull request Mar 30, 2021
With the refactoring PRs rauc#63, rauc#64, rauc#65, rauc#66, rauc#68, rauc#71 and rauc#77, we gained
higher code quality. To keep it that way, introduce useful compiler
warnings for the QA_BUILD that reveal reintroduction of such issues.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Bastian-Krause added a commit to Bastian-Krause/rauc-hawkbit-updater that referenced this pull request Mar 30, 2021
With the refactoring PRs rauc#63, rauc#64, rauc#65, rauc#66, rauc#68, rauc#71 and rauc#77, we gained
higher code quality. To keep it that way, introduce useful compiler
warnings for the QA_BUILD that reveal reintroduction of such issues.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
@Bastian-Krause Bastian-Krause deleted the bst/refactor-rauc-installer branch June 14, 2021 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants