From bd72b3510105599b5bdaf00c203df1164b304238 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 7 Mar 2012 14:44:46 +0100 Subject: Only free returned values on success https://fedorahosted.org/sssd/ticket/1237 --- src/sss_client/autofs/autofs_test_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sss_client/autofs/autofs_test_client.c b/src/sss_client/autofs/autofs_test_client.c index 6e95c174..386c890c 100644 --- a/src/sss_client/autofs/autofs_test_client.c +++ b/src/sss_client/autofs/autofs_test_client.c @@ -79,9 +79,9 @@ int main(int argc, const char *argv[]) ret = _sss_getautomntent_r(&key, &value, ctx); if (ret == 0) { printf("key: %s\t\tvalue: %s\n", key, value); + free(key); + free(value); } - free(key); - free(value); } while(ret == 0); if (ret != 0 && ret != ENOENT) { @@ -99,8 +99,8 @@ int main(int argc, const char *argv[]) exit(EXIT_FAILURE); } else { printf("key: %s\t\tvalue: %s\n", pc_key, value); + free(value); } - free(value); } ret = _sss_endautomntent(&ctx); -- cgit