Module Name: src
Committed By: christos
Date: Wed Nov 25 18:46:24 UTC 2015
Modified Files:
src/lib/libterminfo: termcap.c
Log Message:
PR/50092: Rin Okuyama: Fix memory leak.
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libterminfo/termcap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libterminfo/termcap.c
diff -u src/lib/libterminfo/termcap.c:1.17 src/lib/libterminfo/termcap.c:1.18
--- src/lib/libterminfo/termcap.c:1.17 Sun Nov 13 10:24:04 2011
+++ src/lib/libterminfo/termcap.c Wed Nov 25 13:46:24 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: termcap.c,v 1.17 2011/11/13 15:24:04 christos Exp $ */
+/* $NetBSD: termcap.c,v 1.18 2015/11/25 18:46:24 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: termcap.c,v 1.17 2011/11/13 15:24:04 christos Exp $");
+__RCSID("$NetBSD: termcap.c,v 1.18 2015/11/25 18:46:24 christos Exp $");
#include <assert.h>
#include <ctype.h>
@@ -553,8 +553,11 @@ captoinfo(char *cap)
else
len += rl;
p = realloc(info, len);
- if (p == NULL)
+ if (p == NULL) {
+ if (fv == 1)
+ free(val);
return NULL;
+ }
info = p;
}