1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

core: fix memory leak during deserialization

when activation-details-unit-name is encountered multiple times.

Resolves: #27623
This commit is contained in:
Frantisek Sumsal 2023-05-12 10:23:56 +02:00 committed by Yu Watanabe
parent 104afc7300
commit e8dba80626
2 changed files with 11 additions and 3 deletions

View File

@ -6151,6 +6151,8 @@ void activation_details_serialize(ActivationDetails *details, FILE *f) {
}
int activation_details_deserialize(const char *key, const char *value, ActivationDetails **details) {
int r;
assert(key);
assert(value);
assert(details);
@ -6182,9 +6184,9 @@ int activation_details_deserialize(const char *key, const char *value, Activatio
}
if (streq(key, "activation-details-unit-name")) {
(*details)->trigger_unit_name = strdup(value);
if (!(*details)->trigger_unit_name)
return -ENOMEM;
r = free_and_strdup(&(*details)->trigger_unit_name, value);
if (r < 0)
return r;
return 0;
}

View File

@ -0,0 +1,6 @@
y.service
job
activation-details-unit-type=path
activation-details-unit-name
activation-details-unit-name