Return-Path: X-Original-To: apmail-apr-commits-archive@www.apache.org Delivered-To: apmail-apr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D0160E571 for ; Sat, 2 Feb 2013 12:51:27 +0000 (UTC) Received: (qmail 36844 invoked by uid 500); 2 Feb 2013 12:51:27 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 36637 invoked by uid 500); 2 Feb 2013 12:51:22 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 36602 invoked by uid 99); 2 Feb 2013 12:51:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2013 12:51:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2013 12:51:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1C88123888CD; Sat, 2 Feb 2013 12:50:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1441742 - /apr/apr/trunk/poll/unix/z_asio.c Date: Sat, 02 Feb 2013 12:50:59 -0000 To: commits@apr.apache.org From: gregames@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130202125059.1C88123888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gregames Date: Sat Feb 2 12:50:58 2013 New Revision: 1441742 URL: http://svn.apache.org/viewvc?rev=1441742&view=rev Log: fix memory leak Modified: apr/apr/trunk/poll/unix/z_asio.c Modified: apr/apr/trunk/poll/unix/z_asio.c URL: http://svn.apache.org/viewvc/apr/apr/trunk/poll/unix/z_asio.c?rev=1441742&r1=1441741&r2=1441742&view=diff ============================================================================== --- apr/apr/trunk/poll/unix/z_asio.c (original) +++ apr/apr/trunk/poll/unix/z_asio.c Sat Feb 2 12:50:58 2013 @@ -63,7 +63,7 @@ struct apr_pollset_private_t apr_thread_mutex_t *ring_lock; #endif - /* A hash of all active elements used for O(1) garbage collection */ + /* A hash of all active elements used for O(1) _remove operations */ apr_hash_t *elems; APR_RING_HEAD(ready_ring_t, asio_elem_t) ready_ring; @@ -640,6 +640,15 @@ static apr_status_t asio_pollset_poll(ap */ if (elem->state == ASIO_REMOVED) { + + /* + * async i/o is done since it was found on prior_ready + * the state says the caller is done with it too + * so recycle the elem + */ + + APR_RING_INSERT_TAIL(&(priv->free_ring), elem, + asio_elem_t, link); continue; /* do not re-add if it has been _removed */ }