heimdal: small code adaption to cherry-pick heimdal commit
[sfrench/samba-autobuild/.git] / source4 / heimdal / lib / krb5 / config_file.c
index 1f0446799811e0667cf32b635286c7a80c3533a1..a505b63519bf949e6adb0db8a96b7be9165dcad4 100644 (file)
@@ -444,22 +444,17 @@ krb5_config_parse_file_multi (krb5_context context,
                home = pw->pw_dir;
        }
        if (home) {
-           asprintf(&newfname, "%s%s", home, &fname[1]);
-           if (newfname == NULL) {
-               krb5_set_error_message(context, ENOMEM,
-                                      N_("malloc: out of memory", ""));
-               return ENOMEM;
-           }
+           int aret;
+
+           aret = asprintf(&newfname, "%s%s", home, &fname[1]);
+           if (aret == -1 || newfname == NULL)
+               return krb5_enomem(context);
            fname = newfname;
        }
 #else  /* KRB5_USE_PATH_TOKENS */
        if (asprintf(&newfname, "%%{USERCONFIG}%s", &fname[1]) < 0 ||
            newfname == NULL)
-       {
-           krb5_set_error_message(context, ENOMEM,
-                                  N_("malloc: out of memory", ""));
-           return ENOMEM;
-       }
+           return krb5_enomem(context);
        fname = newfname;
 #endif
     }