From: Dan Smith Subject: Avoid leaking unattached socket objects on restore Date: Tue, 15 Sep 2009 09:52:09 -0700 Message-ID: <1253033531-6764-1-git-send-email-danms@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org List-Id: containers.vger.kernel.org When we restore socket objects that are not attached to a file, we leak the struct socket object because only an fput(file) results in the necessary sock_release(). This set provides a proposed solution to that problem by adding a cleanup operation to the objhash operations structure which is called at objhash teardown time. This gives us the opportunity to call sock_release() on sockets that we have put into the hash that were never attached to a file and thus avoid the leak.