apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r428521 - /apr/apr-util/trunk/memcache/apr_memcache.c
Date Thu, 03 Aug 2006 20:46:56 GMT
Author: pquerna
Date: Thu Aug  3 13:46:56 2006
New Revision: 428521

URL: http://svn.apache.org/viewvc?rev=428521&view=rev
Log:
When there is any kind of error in the creation of the socket or the initial connection, make
sure we destroy our subpool, instead of just leaking resources into the parent pool.  This
fixes a socket fd leak if the memcache node you are connecting to is not online.

Modified:
    apr/apr-util/trunk/memcache/apr_memcache.c

Modified: apr/apr-util/trunk/memcache/apr_memcache.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/memcache/apr_memcache.c?rev=428521&r1=428520&r2=428521&view=diff
==============================================================================
--- apr/apr-util/trunk/memcache/apr_memcache.c (original)
+++ apr/apr-util/trunk/memcache/apr_memcache.c Thu Aug  3 13:46:56 2006
@@ -286,6 +286,7 @@
     rv = apr_socket_create(&conn->sock, APR_INET, SOCK_STREAM, 0, np);
 
     if (rv != APR_SUCCESS) {
+        apr_pool_destroy(np);
         return rv;
     }
 
@@ -300,8 +301,13 @@
     APR_BRIGADE_INSERT_TAIL(conn->bb, e);
 
     rv = conn_connect(conn);
-    *conn_ = conn;
-
+    if (rv != APR_SUCCESS) {
+        apr_pool_destroy(np);
+    }
+    else {
+        *conn_ = conn;
+    }
+    
     return rv;
 }
 



Mime
View raw message