You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Max Okumoto <ok...@ucsd.edu> on 2001/12/03 10:39:49 UTC

pc.dph used after destroyed

In function svn_ra_dav__get_props() the variable 'req' becomes
invalid when ne_propfind_destroy(pc.dph) is called.

But is used several lines down:
 if (404 == ne_get_status(req)->code)


				Max Okumoto



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pc.dph used after destroyed

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
For stuff like this, you don't need to file an issue -- just post a
description of the problem, a log message, and a patch. :-) (When it's
a bug that can be demonstrated easily, great to include a reproduction
recipe too.)

Can you do this for the two problems you discovered below?

Thanks,
-K

Max Okumoto <ok...@ucsd.edu> writes:
> Found a leak in svn_ra_dav__open()
> 
> When the repository is parsed with uri_parse(), the
> variable 'uri' has strings allocated via ne_strdup()
> 
> If an errr occurs before the session_baton is created
> then all the strings are lost when the function returns.
> 
> 			Max Okumoto
> 
> PS. Should I put this in as a 'issue'

Max Okumoto <ok...@ucsd.edu> writes:
> In function svn_ra_dav__get_props() the variable 'req' becomes
> invalid when ne_propfind_destroy(pc.dph) is called.
> 
> But is used several lines down:
>  if (404 == ne_get_status(req)->code)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pc.dph used after destroyed

Posted by cm...@collab.net.
Max Okumoto <ok...@ucsd.edu> writes:

> > In function svn_ra_dav__get_props() the variable 'req' becomes
> > invalid when ne_propfind_destroy(pc.dph) is called.
> > 
> > But is used several lines down:
> >  if (404 == ne_get_status(req)->code)
> 
> * subversion/libsvn_ra_dav/props.c
>   Extract status code from request object before it gets destroyed
>   and use that value in the test.

This (and your other 2 similar) patches have been committed.  Thanks,
Max!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: pc.dph used after destroyed

Posted by Max Okumoto <ok...@ucsd.edu>.
> In function svn_ra_dav__get_props() the variable 'req' becomes
> invalid when ne_propfind_destroy(pc.dph) is called.
> 
> But is used several lines down:
>  if (404 == ne_get_status(req)->code)

* subversion/libsvn_ra_dav/props.c
  Extract status code from request object before it gets destroyed
  and use that value in the test.

Index: subversion/libsvn_ra_dav/props.c
===================================================================
--- subversion/libsvn_ra_dav/.svn/text-base/props.c.svn-base	Sun Dec  2 13:34:41 2001
+++ subversion/libsvn_ra_dav/props.c	Tue Dec  4 03:54:50 2001
@@ -312,6 +312,7 @@
   svn_string_t my_url;
   svn_stringbuf_t *url_str;
   ne_request *req;
+  int status_code;
 
   my_url.data = url;
   my_url.len = strlen(url);
@@ -342,6 +343,8 @@
       rv = ne_propfind_allprop(pc.dph, process_results, &pc);
     }
 
+  status_code = ne_get_status(req)->code;
+
   ne_propfind_destroy(pc.dph);
 
   if (rv != NE_OK)
@@ -364,7 +367,7 @@
         }
     }
 
-  if (404 == ne_get_status(req)->code)
+  if (404 == status_code)
     return svn_error_createf(SVN_ERR_RA_PROPS_NOT_FOUND, 0, NULL, pool,
                              "Failed to fetch props for '%s'", url_str->data);
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org