mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-07 06:28:21 +02:00
merge: branch 'jv/edit-memory-leak'
nmcli/edit: fix memory leak in extract_setting_and_property https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2013
This commit is contained in:
commit
2bc5c56119
1 changed files with 9 additions and 2 deletions
|
|
@ -6584,8 +6584,15 @@ extract_setting_and_property(const char *prompt, const char *line, char **settin
|
|||
p2 = dot + 1;
|
||||
num1 = strcspn(p1, ".");
|
||||
num2 = len > num1 + 1 ? len - num1 - 1 : 0;
|
||||
sett = num1 > 0 ? g_strndup(p1, num1) : sett;
|
||||
prop = num2 > 0 ? g_strndup(p2, num2) : prop;
|
||||
if (num1 > 0) {
|
||||
g_free(sett);
|
||||
sett = g_strndup(p1, num1);
|
||||
}
|
||||
|
||||
if (num2 > 0) {
|
||||
g_free(prop);
|
||||
prop = g_strndup(p2, num2);
|
||||
}
|
||||
} else {
|
||||
if (!prop)
|
||||
prop = len > 0 ? g_strndup(p1, len) : NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue