diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-04-06 17:09:06 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-04-06 17:09:06 +0000 |
commit | 345e1a8d8b41548e39a902fd63d8ca67904917d2 (patch) | |
tree | 32928079c5a46bab0fab2ca64ac0524118eaff06 | |
parent | e152d7ccfb4fdaa6254c6582a15a5b0e97e94809 (diff) |
plug memleak in rcs_splitlines()
ok jfb@
-rw-r--r-- | usr.bin/cvs/rcs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 315c2b52ab3..adb6b838a61 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.37 2005/03/26 08:09:54 tedu Exp $ */ +/* $OpenBSD: rcs.c,v 1.38 2005/04/06 17:09:05 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -2134,8 +2134,10 @@ rcs_splitlines(const char *fcont) * in rcs_patch(). */ lp = (struct rcs_line *)malloc(sizeof(*lp)); - if (lp == NULL) + if (lp == NULL) { + rcs_freefoo(foo); return (NULL); + } lp->rl_line = NULL; lp->rl_lineno = 0; @@ -2145,6 +2147,7 @@ rcs_splitlines(const char *fcont) for (dcp = foo->rl_data; *dcp != '\0';) { lp = (struct rcs_line *)malloc(sizeof(*lp)); if (lp == NULL) { + rcs_freefoo(foo); cvs_log(LP_ERR, "failed to allocate line entry"); return (NULL); } |