>From a5911ab994c06978e0a0b78928553d7868afe604 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Tue, 27 May 2014 14:53:11 +0200 Subject: [PATCH 2/2] sss_autofs: Do not try to free empty autofs context If initialisation fails in function _sss_setautomntent, context will not be initialized and automount client will crash. The function _sss_endautomntent should not try to dereference NULL pointer. Resolves: https://fedorahosted.org/sssd/ticket/2288 --- src/sss_client/autofs/sss_autofs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sss_client/autofs/sss_autofs.c b/src/sss_client/autofs/sss_autofs.c index 787b9f2b5161af85690e8c16e34cd42a527f39dd..02f91ab2b3d29a189e949f6a8d645ea4ccd7f6e3 100644 --- a/src/sss_client/autofs/sss_autofs.c +++ b/src/sss_client/autofs/sss_autofs.c @@ -459,8 +459,10 @@ _sss_endautomntent(void **context) fctx = (struct automtent *) *context; - free(fctx->mapname); - free(fctx); + if (fctx != NULL) { + free(fctx->mapname); + free(fctx); + } ret = sss_autofs_make_request(SSS_AUTOFS_ENDAUTOMNTENT, NULL, NULL, NULL, &errnop); -- 1.9.3