catch error from as.*printf
This commit is contained in:
@@ -247,7 +247,7 @@ krb5_get_error_message(krb5_context context, krb5_error_code code)
|
|||||||
return strdup(msg);
|
return strdup(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(&str, "<unknown error: %d>", (int)code) == -1)
|
if (asprintf(&str, "<unknown error: %d>", (int)code) == -1 || str == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
@@ -298,10 +298,10 @@ _expand_temp_folder(krb5_context context, PTYPE param, const char *postfix, char
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_expand_userid(krb5_context context, PTYPE param, const char *postfix, char **ret)
|
_expand_userid(krb5_context context, PTYPE param, const char *postfix, char **str)
|
||||||
{
|
{
|
||||||
asprintf(ret, "%ld", (unsigned long)getuid());
|
int ret = asprintf(str, "%ld", (unsigned long)getuid());
|
||||||
if (*ret == NULL)
|
if (ret < 0 || *str == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -307,7 +307,7 @@ _krb5_erase_file(krb5_context context, const char *filename)
|
|||||||
static krb5_error_code
|
static krb5_error_code
|
||||||
fcc_gen_new(krb5_context context, krb5_ccache *id)
|
fcc_gen_new(krb5_context context, krb5_ccache *id)
|
||||||
{
|
{
|
||||||
char *file, *exp_file = NULL;
|
char *file = NULL, *exp_file = NULL;
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
krb5_fcache *f;
|
krb5_fcache *f;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -318,8 +318,8 @@ fcc_gen_new(krb5_context context, krb5_ccache *id)
|
|||||||
N_("malloc: out of memory", ""));
|
N_("malloc: out of memory", ""));
|
||||||
return KRB5_CC_NOMEM;
|
return KRB5_CC_NOMEM;
|
||||||
}
|
}
|
||||||
asprintf (&file, "%sXXXXXX", KRB5_DEFAULT_CCFILE_ROOT);
|
ret = asprintf (&file, "%sXXXXXX", KRB5_DEFAULT_CCFILE_ROOT);
|
||||||
if(file == NULL) {
|
if(ret < 0 || file == NULL) {
|
||||||
free(f);
|
free(f);
|
||||||
krb5_set_error_message(context, KRB5_CC_NOMEM,
|
krb5_set_error_message(context, KRB5_CC_NOMEM,
|
||||||
N_("malloc: out of memory", ""));
|
N_("malloc: out of memory", ""));
|
||||||
@@ -764,7 +764,7 @@ fcc_remove_cred(krb5_context context,
|
|||||||
{
|
{
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
krb5_ccache copy, newfile;
|
krb5_ccache copy, newfile;
|
||||||
char *newname;
|
char *newname = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
ret = krb5_cc_new_unique(context, krb5_cc_type_memory, NULL, ©);
|
ret = krb5_cc_new_unique(context, krb5_cc_type_memory, NULL, ©);
|
||||||
@@ -783,10 +783,10 @@ fcc_remove_cred(krb5_context context,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
asprintf(&newname, "FILE:%s.XXXXXX", FILENAME(id));
|
ret = asprintf(&newname, "FILE:%s.XXXXXX", FILENAME(id));
|
||||||
if (newname == NULL) {
|
if (ret < 0 || newname == NULL) {
|
||||||
krb5_cc_destroy(context, copy);
|
krb5_cc_destroy(context, copy);
|
||||||
return ret;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = mkstemp(&newname[5]);
|
fd = mkstemp(&newname[5]);
|
||||||
|
@@ -428,8 +428,8 @@ krb5_vlog_msg(krb5_context context,
|
|||||||
krb5_format_time(context, t, buf, sizeof(buf), TRUE);
|
krb5_format_time(context, t, buf, sizeof(buf), TRUE);
|
||||||
}
|
}
|
||||||
if(actual == NULL) {
|
if(actual == NULL) {
|
||||||
vasprintf(&msg, fmt, ap);
|
int ret = vasprintf(&msg, fmt, ap);
|
||||||
if(msg == NULL)
|
if(ret < 0 || msg == NULL)
|
||||||
actual = fmt;
|
actual = fmt;
|
||||||
else
|
else
|
||||||
actual = msg;
|
actual = msg;
|
||||||
|
Reference in New Issue
Block a user