summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-03-07 14:44:46 +0100
committerStephen Gallagher <sgallagh@redhat.com>2012-04-09 09:14:19 -0400
commit91547076daa42c361943b048a355c70e7fd5170c (patch)
treeeded6c15d312bbe58edf94b8ef6af5fb4cec403d
parentc519f45f88e77e7bd5fcd7dff46ffcfc064cfe1d (diff)
downloadsssd-91547076daa42c361943b048a355c70e7fd5170c.tar.gz
sssd-91547076daa42c361943b048a355c70e7fd5170c.tar.xz
sssd-91547076daa42c361943b048a355c70e7fd5170c.zip
Only free returned values on success
https://fedorahosted.org/sssd/ticket/1237
-rw-r--r--src/sss_client/autofs/autofs_test_client.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sss_client/autofs/autofs_test_client.c b/src/sss_client/autofs/autofs_test_client.c
index 6e95c1749..386c890c6 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);