Module Name: src Committed By: spz Date: Sun Jul 15 09:13:59 UTC 2012
Modified Files: src/dist/nvi/common: exf.c Log Message: Use after free (Coverity 273146) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/dist/nvi/common/exf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/dist/nvi/common/exf.c diff -u src/dist/nvi/common/exf.c:1.4 src/dist/nvi/common/exf.c:1.5 --- src/dist/nvi/common/exf.c:1.4 Sat Nov 14 20:01:20 2009 +++ src/dist/nvi/common/exf.c Sun Jul 15 09:13:59 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: exf.c,v 1.4 2009/11/14 20:01:20 tnozaki Exp $ */ +/* $NetBSD: exf.c,v 1.5 2012/07/15 09:13:59 spz Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -173,6 +173,7 @@ file_init(SCR *sp, FREF *frp, char *rcv_ exfp->minode == sb.st_ino && (exfp != sp->ep || exfp->refcnt > 1)) { ep = exfp; + oname = ep->rcv_path; goto postinit; } } @@ -807,8 +808,10 @@ file_end(SCR *sp, EXF *ep, int force) (void)close(ep->rcv_fd); if (ep->env_path != NULL) free(ep->env_path); - if (ep->rcv_path != NULL) + if (ep->rcv_path != NULL) { free(ep->rcv_path); + ep->rcv_path = NULL; + } if (ep->rcv_mpath != NULL) free(ep->rcv_mpath); @@ -1251,6 +1254,8 @@ file_backup(SCR *sp, const char *name, c } if (bp != NULL) FREE_SPACE(sp, bp, blen); + if (d != NULL) + free(d); return (0); alloc_err: