protect against double free; #660; zardoz at users.sf.net

from openbsd
This commit is contained in:
itojun 2003-09-18 08:16:40 +00:00
parent c2011dbc01
commit 841f7944e5

View File

@ -1,4 +1,4 @@
/* $NetBSD: buffer.c,v 1.4 2003/09/16 23:16:59 christos Exp $ */
/* $NetBSD: buffer.c,v 1.5 2003/09/18 08:16:40 itojun Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -14,7 +14,7 @@
#include "includes.h"
RCSID("$OpenBSD: buffer.c,v 1.16 2002/06/26 08:54:18 markus Exp $");
__RCSID("$NetBSD: buffer.c,v 1.4 2003/09/16 23:16:59 christos Exp $");
__RCSID("$NetBSD: buffer.c,v 1.5 2003/09/18 08:16:40 itojun Exp $");
#include "xmalloc.h"
#include "buffer.h"
@ -42,6 +42,7 @@ buffer_free(Buffer *buffer)
if (buffer->alloc > 0) {
memset(buffer->buf, 0, buffer->alloc);
xfree(buffer->buf);
buffer->alloc = 0;
}
}