Coverity CID 5024: Fix double free on error path.

This commit is contained in:
christos 2008-05-24 16:37:49 +00:00
parent a2c63c0004
commit ea988594e2

View File

@ -1,4 +1,4 @@
/* $NetBSD: fileio.c,v 1.2 2008/05/02 11:13:02 martin Exp $ */
/* $NetBSD: fileio.c,v 1.3 2008/05/24 16:37:49 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fileio.c,v 1.2 2008/05/02 11:13:02 martin Exp $");
__RCSID("$NetBSD: fileio.c,v 1.3 2008/05/24 16:37:49 christos Exp $");
#endif /* not lint */
#include "curses.h"
@ -210,6 +210,7 @@ getwin(FILE *fp)
win->scr_t = wtmp->scr_t;
win->scr_b = wtmp->scr_b;
free(wtmp);
wtmp = NULL;
__swflags(win);
#ifdef HAVE_WCHAR
@ -242,6 +243,7 @@ getwin(FILE *fp)
error1:
delwin(win);
error0:
free(wtmp);
if (wtmp)
free(wtmp);
return NULL;
}