Skip to content

nmcli/edit: fix memory leak in extract_setting_and_property

Jan Vaclav requested to merge jv/edit-memory-leak into main

Summary

In case the user selects a setting/property with "goto" command, and then attempts to tab-complete a setting/property pair, the original sett and prop strings are overriden without freeing:

nmcli > goto 802-1x.pac-file
nmcli 802-1x.pac-file> set 802-1.lal<TAB>

Purpose

Fixes a leak in extract_setting_and_property(), which does not free a setting/property string when appropriate.

Checklist

Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:

  • the subject for all commits is concise and explicative
  • the message for all commits explains the reason for the change
  • the source is properly formatted
  • any relevant documentation is up to date
  • you have added unit tests if applicable
  • the NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.
Edited by Jan Vaclav

Merge request reports