=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/rcs.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- src/usr.bin/rcs/rcs.c 2010/10/27 08:35:45 1.71 +++ src/usr.bin/rcs/rcs.c 2010/12/10 09:48:43 1.72 @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.71 2010/10/27 08:35:45 tobias Exp $ */ +/* $OpenBSD: rcs.c,v 1.72 2010/12/10 09:48:43 jasper Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -474,11 +474,14 @@ } if ((dst = fopen(to, "w")) == NULL) { warn("%s", to); + (void)fclose(src); return (-1); } if (fchmod(fileno(dst), perm)) { warn("%s", to); (void)unlink(to); + (void)fclose(src); + (void)fclose(dst); return (-1); } @@ -499,11 +502,11 @@ ret = 0; - (void)fclose(src); - (void)fclose(dst); (void)unlink(from); out: + (void)fclose(src); + (void)fclose(dst); xfree(buf); return (ret);