mirror of
https://github.com/systemd/systemd.git
synced 2026-07-13 10:59:49 +00:00
networkctl: avoid leak if a field was specified twice
The input data would have to be borked, so this is unlikely to happen, but since we have a nice helper function to do it properly... why not? CID #1261390.
This commit is contained in:
Notes:
Lennart Poettering
2015-05-21 17:52:29 +02:00
Backport: bugfix
@@ -965,14 +965,14 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
|
||||
continue;
|
||||
|
||||
if (streq(a, "_Chassis")) {
|
||||
chassis = strdup(b);
|
||||
if (!chassis)
|
||||
return -ENOMEM;
|
||||
r = free_and_strdup(&chassis, b);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
} else if (streq(a, "_Port")) {
|
||||
port = strdup(b);
|
||||
if (!port)
|
||||
return -ENOMEM;
|
||||
r = free_and_strdup(&port, b);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
} else if (streq(a, "_TTL")) {
|
||||
long long unsigned x;
|
||||
|
||||
Reference in New Issue
Block a user