From 350cdb1b99341d390320f98ee40e29ec2f864be8 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Fri, 31 Oct 2008 18:35:28 +0000 Subject: [PATCH] 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 --- src/util/support/k5buf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- 2.26.2