[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 7978 - trunk/subversion/libsvn_subr

From: <kfogel_at_collab.net>
Date: 2003-12-11 20:28:56 CET

dionisos@tigris.org writes:
> Log:
> Fix possible leaking of temporary file.
>
> * subversion/libsvn_subr/subst.c (svn_subst_copy_and_translate): Eliminate
> possible leaking of temporary file.

I understand the spirit of this change, but are you sure you did it
correctly?

For example:

> Modified: trunk/subversion/libsvn_subr/subst.c
> ==============================================================================
> --- trunk/subversion/libsvn_subr/subst.c (original)
> +++ trunk/subversion/libsvn_subr/subst.c Thu Dec 11 13:16:39 2003
> @@ -735,33 +735,35 @@
> eol_str, repair, keywords, expand);
>
> if (err)
> - {
> - /* ignore closure errors if we're bailing. */
> - svn_error_clear (svn_stream_close (src_stream));
> - svn_error_clear (svn_stream_close (dst_stream));
> - if (s)
> - apr_file_close (s);
> - if (d)
> - apr_file_close (d);
> -
> - svn_error_clear (svn_io_remove_file (dst_tmp, pool));
> - return
> - svn_error_createf (err->apr_err, err,
> - "File translation failed when copying '%s' to '%s'",
> - src, dst);
> - }
> + goto error;

The specific error message disappears here, but does not reappear
anywhere else. It has been lost.

Also, the old code tested s and d before closing them; the new code
does not (I followed the code path down to do_io_file_wrapper_cleanup
in io.c, it just assumes that the file is not null). Is this safe?

-Karl, beginning to think Greg Stein is right about being stricter on
       all trunk commits starting now...

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Dec 11 21:17:12 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.