diff --git a/source4/heimdal/lib/krb5/appdefault.c b/source4/heimdal/lib/krb5/appdefault.c
index d4dc758..11297c2 100644
--- a/source4/heimdal/lib/krb5/appdefault.c
+++ b/source4/heimdal/lib/krb5/appdefault.c
@@ -127,8 +127,9 @@ krb5_appdefault_time(krb5_context context, const char *appname,
     krb5_deltat t;
     char *val;
 
-    krb5_appdefault_string(context, appname, realm, option, NULL, &val);
-    if (val == NULL) {
+    krb5_appdefault_string(context, appname, realm, option, "", &val);
+    if (val == NULL || *val == '\0') {
+	if (val) free(val);
 	*ret_val = def_val;
 	return;
     }
