Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/nvi/dist/ex CID 1062357: Plug memory leak
details: https://anonhg.NetBSD.org/src/rev/5f23f29dd5f5
branches: trunk
changeset: 791674:5f23f29dd5f5
user: christos <christos%NetBSD.org@localhost>
date: Wed Nov 27 21:13:16 2013 +0000
description:
CID 1062357: Plug memory leak
diffstat:
external/bsd/nvi/dist/ex/ex_at.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r c392e754d7c1 -r 5f23f29dd5f5 external/bsd/nvi/dist/ex/ex_at.c
--- a/external/bsd/nvi/dist/ex/ex_at.c Wed Nov 27 20:52:24 2013 +0000
+++ b/external/bsd/nvi/dist/ex/ex_at.c Wed Nov 27 21:13:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ex_at.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: ex_at.c,v 1.4 2013/11/27 21:13:16 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -107,7 +107,7 @@
tp != NULL; tp = TAILQ_PREV(tp, _texth, q))
len += tp->len + 1;
- MALLOC_RET(sp, ecp->cp, CHAR_T *, len * 2 * sizeof(CHAR_T));
+ MALLOC_GOTO(sp, ecp->cp, CHAR_T *, len * 2 * sizeof(CHAR_T));
ecp->o_cp = ecp->cp;
ecp->o_clen = len;
ecp->cp[len] = '\0';
@@ -122,4 +122,7 @@
LIST_INSERT_HEAD(&sp->wp->ecq, ecp, q);
return (0);
+alloc_err:
+ free(ecp);
+ return 1;
}
Home |
Main Index |
Thread Index |
Old Index