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

Re: mem leaks in svn_ra_dav__open()

From: Max Okumoto <okumoto_at_ucsd.edu>
Date: 2001-12-04 12:45:44 CET

> 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

* subversion/libsvn_ra_dav/session.c
  Fixed leak in svn_ra_dav__open() by freeing string before
  returning when error is detected.

Index: subversion/libsvn_ra_dav/session.c
===================================================================
--- subversion/libsvn_ra_dav/.svn/text-base/session.c.svn-base Sun Dec 2 13:34:39 2001
+++ subversion/libsvn_ra_dav/session.c Tue Dec 4 03:36:27 2001
@@ -108,12 +108,14 @@
   if (uri_parse(repository, &uri, NULL)
       || uri.host == NULL || uri.path == NULL)
     {
+ uri_free(&uri);
       return svn_error_create(SVN_ERR_RA_ILLEGAL_URL, 0, NULL, pool,
                               "illegal URL for repository");
     }
 
   /* Can we initialize network? */
   if (sock_init() != 0) {
+ uri_free(&uri);
     return svn_error_create(SVN_ERR_RA_SOCK_INIT, 0, NULL, pool,
                             "network socket initialization failed");
   }
@@ -151,6 +153,7 @@
         }
       if (ne_set_secure(sess, 1))
         {
+ uri_free(&uri);
           return svn_error_create(SVN_ERR_RA_SOCK_INIT, 0, NULL, pool,
                                   "SSL is not supported");
         }
@@ -173,6 +176,7 @@
 
   if (ne_session_server(sess, uri.host, uri.port))
     {
+ uri_free(&uri);
       return svn_error_createf(SVN_ERR_RA_HOSTNAME_LOOKUP, 0, NULL, pool,
                                "Hostname not found: %s", uri.host);
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:51 2006

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.