static variable and free it called again; this prevents a memory
leak.
ticket: 1357
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15215
dc483132-0cff-0310-8789-
dd5450dbe970
+2003-03-03 Tom Yu <tlyu@mit.edu>
+
+ * g_cnffile.c (krb__get_srvtabname): Keep strdup()ed string in a
+ static variable and free it called again; this prevents a memory
+ leak.
+
2003-02-28 Ezra Peisach <epeisach@bu.edu>
* Makefile.in (clean-unix): Remove krb_err_txt.c on clean. Update
const char* names[3];
char **full_name = 0, **cpp;
krb5_error_code retval;
- char *retname;
+ static char *retname;
if (!krb5__krb4_context)
krb5_init_context(&krb5__krb4_context);
retval = profile_get_values(krb5__krb4_context->profile, names,
&full_name);
if (retval == 0 && full_name && full_name[0]) {
+ if (retname != NULL)
+ free(retname);
retname = strdup(full_name[0]);
for (cpp = full_name; *cpp; cpp++)
krb5_xfree(*cpp);
return retname;
}
}
+ if (retname != NULL)
+ free(retname);
retname = strdup(default_srvtabname);
return retname;
}