summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2008-10-31 18:35:28 +0000
committerGreg Hudson <ghudson@mit.edu>2008-10-31 18:35:28 +0000
commit350cdb1b99341d390320f98ee40e29ec2f864be8 (patch)
tree572ad3f93c3ec98c71b3ca92aebe5975e57495d0
parentea9c53fe741df01e6b75a4f97964f33b88e05125 (diff)
downloadkrb5-350cdb1b99341d390320f98ee40e29ec2f864be8.tar.gz
krb5-350cdb1b99341d390320f98ee40e29ec2f864be8.tar.xz
krb5-350cdb1b99341d390320f98ee40e29ec2f864be8.zip
Add a few safeties to the k5buf code, to make static analysis tools happier
ticket: 6200 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20943 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/util/support/k5buf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/support/k5buf.c b/src/util/support/k5buf.c
index 23fb20365..974893d6e 100644
--- a/src/util/support/k5buf.c
+++ b/src/util/support/k5buf.c
@@ -72,8 +72,10 @@ static int ensure_space(struct k5buf *buf, size_t len)
return 1;
error_exit:
- if (buf->buftype == DYNAMIC)
+ if (buf->buftype == DYNAMIC) {
free(buf->data);
+ buf->data = NULL;
+ }
buf->buftype = ERROR;
return 0;
}
@@ -206,4 +208,6 @@ void krb5int_free_buf(struct k5buf *buf)
return;
assert(buf->buftype == DYNAMIC);
free(buf->data);
+ buf->data = NULL;
+ buf->buftype = ERROR;
}