diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-01-15 13:42:53 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-01-15 13:42:53 -0500 |
commit | 402a81c7742ee8b66f93f9eb1e7cb6227b6768e4 (patch) | |
tree | 35c298d5fd24d3003a167f084780accc0022abcb | |
parent | a9bd056ad9b3ac8c930a667842b16df97ba8fc97 (diff) |
shared/install-printf: fix memleak
instance might be "", and that string would be leaked.
CID #1368264.
-rw-r--r-- | src/shared/install-printf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c index 823fb61cda..c10ed3d311 100644 --- a/src/shared/install-printf.c +++ b/src/shared/install-printf.c @@ -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; |