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

Fix some warnings identified by a static analyzer #2486

Merged
merged 3 commits into from
Oct 23, 2024

Commits on Oct 23, 2024

  1. all: change checking process name at reload to include not NULL checks

    The code was using the reload variable as an indicator that
    prev_global_data was not NULL, and this was causing some static
    code analysers to to flag up NULL pointer dereferences.
    
    The patch explicitly checks whether prev_global_data is NULL or not,
    since this is synonymous with testing the reload variable.
    
    Signed-off-by: Quentin Armitage <[email protected]>
    pqarmitage committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    061b264 View commit details
    Browse the repository at this point in the history
  2. vrrp: Only use dbus_{in,out}_pipe[0] to indicate pipe is closed

    The code was, in some places, also setting dbus_{in,out}_pipe[1]
    to -1 when it closed the pipes, which is unnecessary. In other places
    it set dbus_{in,out}_pipe[0] to -1 twice, and did not set the [1]
    equivalents at all, which was just wrong.
    
    Signed-off-by: Quentin Armitage <[email protected]>
    pqarmitage committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    43889d1 View commit details
    Browse the repository at this point in the history
  3. all: clear pointers to old data structures freed after reload

    This means that if that if there is a subsequent reference to the
    old data via thoe old_global_data, or old{bfd,check,vrrp} pointers,
    it should cause a segfault rather than undefined behaviour. It will
    also make it more straightford to debug any problem should it occur.
    
    Signed-off-by: Quentin Armitage <[email protected]>
    pqarmitage committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    3f67cc6 View commit details
    Browse the repository at this point in the history