summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2008-04-30 23:46:29 +0000
committerKen Raeburn <raeburn@mit.edu>2008-04-30 23:46:29 +0000
commitc59402909451704c36f862fb2968f6c8e717df4c (patch)
tree6d07f526934e50b795e8b7201e5be0c2e6473b8a /src/lib/krb5
parentec5b9670de4c7af9ebaecfbd305857ee030460c0 (diff)
downloadkrb5-c59402909451704c36f862fb2968f6c8e717df4c.tar.gz
krb5-c59402909451704c36f862fb2968f6c8e717df4c.tar.xz
krb5-c59402909451704c36f862fb2968f6c8e717df4c.zip
(more) After malloc/realloc/calloc/strdup/asprintf failures, use
ENOMEM explicitly instead of reading it from errno. This may make static analysis tools less confused about when we return zero vs nonzero values. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20313 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5')
-rw-r--r--src/lib/krb5/os/changepw.c4
-rw-r--r--src/lib/krb5/os/init_os_ctx.c2
-rw-r--r--src/lib/krb5/os/localaddr.c4
-rw-r--r--src/lib/krb5/os/sendto_kdc.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/krb5/os/changepw.c b/src/lib/krb5/os/changepw.c
index 816713dc4..275f61a63 100644
--- a/src/lib/krb5/os/changepw.c
+++ b/src/lib/krb5/os/changepw.c
@@ -1,7 +1,7 @@
/*
* lib/krb5/os/changepw.c
*
- * Copyright 1990,1999,2001 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1999,2001,2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
@@ -139,7 +139,7 @@ static int kpasswd_sendto_msg_callback(struct conn_state *conn, void *callback_c
local_kaddr.length = addrs[0]->length;
local_kaddr.contents = malloc(addrs[0]->length);
if (local_kaddr.contents == NULL && addrs[0]->length != 0) {
- code = errno;
+ code = ENOMEM;
krb5_free_addresses(ctx->context, addrs);
goto cleanup;
}
diff --git a/src/lib/krb5/os/init_os_ctx.c b/src/lib/krb5/os/init_os_ctx.c
index 132816d05..06a5b6bfa 100644
--- a/src/lib/krb5/os/init_os_ctx.c
+++ b/src/lib/krb5/os/init_os_ctx.c
@@ -309,7 +309,7 @@ add_kdc_config_file(profile_filespec_t **pfiles)
memcpy(newfiles + 1, *pfiles, (count-1) * sizeof(*newfiles));
newfiles[0] = strdup(file);
if (newfiles[0] == NULL) {
- int e = errno;
+ int e = ENOMEM;
free(newfiles);
return e;
}
diff --git a/src/lib/krb5/os/localaddr.c b/src/lib/krb5/os/localaddr.c
index ea8c9a205..55180808e 100644
--- a/src/lib/krb5/os/localaddr.c
+++ b/src/lib/krb5/os/localaddr.c
@@ -559,7 +559,7 @@ foreach_localaddr (/*@null@*/ void *data,
P.buf_size = P.lifnum.lifn_count * sizeof (struct lifreq) * 2;
P.buf = malloc (P.buf_size);
if (P.buf == NULL) {
- retval = errno;
+ retval = ENOMEM;
goto punt;
}
@@ -732,7 +732,7 @@ foreach_localaddr (/*@null@*/ void *data,
P.buf_size = P.if_num * sizeof (struct if_laddrreq) * 2;
P.buf = malloc (P.buf_size);
if (P.buf == NULL) {
- retval = errno;
+ retval = ENOMEM;
goto punt;
}
diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c
index 050aec5f9..cd40cb67b 100644
--- a/src/lib/krb5/os/sendto_kdc.c
+++ b/src/lib/krb5/os/sendto_kdc.c
@@ -1,7 +1,7 @@
/*
* lib/krb5/os/sendto_kdc.c
*
- * Copyright 1990,1991,2001,2002,2004,2005,2007 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991,2001,2002,2004,2005,2007,2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
@@ -1044,7 +1044,7 @@ service_tcp_fd (struct conn_state *conn, struct select_state *selstate,
conn->x.in.buf);
if (conn->x.in.buf == 0) {
/* allocation failure */
- e = errno;
+ e = ENOMEM;
goto kill_conn;
}
}