diff options
author | joe <joe@FreeBSD.org> | 2003-09-26 19:15:53 +0000 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2003-09-26 19:15:53 +0000 |
commit | 62fcef349695e2b63bcd465cb80df34a2bb21b46 (patch) | |
tree | 21c53326b41b26129f0856bc9ab6ceb7229e06cf | |
parent | 175ed5a6e46a7706ecd33dc362294c5f17ad0d1b (diff) | |
parent | dc42ef026434942c55e8af3dd0e975d36afc6843 (diff) | |
download | FreeBSD-src-62fcef349695e2b63bcd465cb80df34a2bb21b46.zip FreeBSD-src-62fcef349695e2b63bcd465cb80df34a2bb21b46.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r120489,
which included commits to RCS files with non-trunk default branches.
-rw-r--r-- | crypto/openssh/buffer.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/openssh/buffer.c b/crypto/openssh/buffer.c index 8ff8c2f..9c9ca64 100644 --- a/crypto/openssh/buffer.c +++ b/crypto/openssh/buffer.c @@ -23,8 +23,11 @@ RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $"); void buffer_init(Buffer *buffer) { - buffer->alloc = 4096; - buffer->buf = xmalloc(buffer->alloc); + const u_int len = 4096; + + buffer->alloc = 0; + buffer->buf = xmalloc(len); + buffer->alloc = len; buffer->offset = 0; buffer->end = 0; } @@ -34,8 +37,10 @@ buffer_init(Buffer *buffer) void buffer_free(Buffer *buffer) { - memset(buffer->buf, 0, buffer->alloc); - xfree(buffer->buf); + if (buffer->alloc > 0) { + memset(buffer->buf, 0, buffer->alloc); + xfree(buffer->buf); + } } /* |