From 01f0d708fddfd50bdbb36a63737dcdc2c2fbd28d Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Tue, 27 May 2014 14:53:11 +0200 Subject: 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 Reviewed-by: Jakub Hrozek --- 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 787b9f2b5..02f91ab2b 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); -- cgit