mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 17:51:22 +03:00
shared/install-printf: fix memleak
instance might be "", and that string would be leaked. CID #1368264.
This commit is contained in:
parent
a9bd056ad9
commit
402a81c774
@ -93,9 +93,9 @@ static int specifier_instance(char specifier, void *data, void *userdata, char *
|
||||
return r;
|
||||
|
||||
if (isempty(instance)) {
|
||||
instance = strdup(i->default_instance ?: "");
|
||||
if (!instance)
|
||||
return -ENOMEM;
|
||||
r = free_and_strdup(&instance, i->default_instance ?: "");
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
*ret = instance;
|
||||
|
Loading…
Reference in New Issue
Block a user