summary refs log tree commit diff
path: root/src/nmcli/connections.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2024-08-26 16:10:34 +0200
committerMichael Biebl <biebl@debian.org>2024-08-26 16:10:34 +0200
commit681dfc70ef98f6ed0c05bcb0fbff00e3fc0799ea (patch)
treede71fafaa05ed5aa070324c3b731206150098781 /src/nmcli/connections.c
parente96d74409128c6a977e31f24fad9b267d2feb9a1 (diff)
New upstream version 1.48.10 upstream/1.48.10
Diffstat (limited to 'src/nmcli/connections.c')
-rw-r--r--src/nmcli/connections.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c
index 9eac7b9a..7e192388 100644
--- a/src/nmcli/connections.c
+++ b/src/nmcli/connections.c
@@ -6576,8 +6576,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;