From 03d7e3207a8758130d7e2431cd886bb3edfc6190 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: May 27 2014 19:23:04 +0000 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 (cherry picked from commit 01f0d708fddfd50bdbb36a63737dcdc2c2fbd28d) --- diff --git a/src/sss_client/autofs/sss_autofs.c b/src/sss_client/autofs/sss_autofs.c index f86ea86..539e8ad 100644 --- a/src/sss_client/autofs/sss_autofs.c +++ b/src/sss_client/autofs/sss_autofs.c @@ -455,8 +455,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);