From: Greg Hudson Date: Fri, 31 Oct 2008 18:35:28 +0000 (+0000) Subject: Add a few safeties to the k5buf code, to make static analysis tools happier X-Git-Tag: krb5-1.7-alpha1~241 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=350cdb1b99341d390320f98ee40e29ec2f864be8;p=krb5.git 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 --- 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; }