1
0
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:
Zbigniew Jędrzejewski-Szmek 2017-01-15 13:42:53 -05:00
parent a9bd056ad9
commit 402a81c774

View File

@ -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;