From owner-freebsd-fs@FreeBSD.ORG Fri Sep 24 03:51:06 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 596EF1065672 for ; Fri, 24 Sep 2010 03:51:06 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id E35BC8FC1C for ; Fri, 24 Sep 2010 03:51:05 +0000 (UTC) Received: by fxm9 with SMTP id 9so1933523fxm.13 for ; Thu, 23 Sep 2010 20:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:user-agent :date:message-id:mime-version:content-type; bh=WNNtzBfwu6vaRWbXwXwWU51gFTIuC7aYHzwq2/GS4kE=; b=r4/Ma7EWVFYEc2ecCsWq7O9mlITmXIlAyL+5+Xbc34mBOgy9cvNAOsPs/dD1cW+6ON V1HYOlc5JLQuIqww6yWtKjWqG0Xv1mObRE3+UhEesNTLAW8hVSdzSg7FerszVn5ehvFn RVU+KV7UtnK+vIwF2C2G3LnlJ5/YEX5JU7H+I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:user-agent:date:message-id:mime-version :content-type; b=uw7IF1j8vn25WGb+RcoTu1DfVxP59M5pNuaKP3OUWwAI8KgOlNpcYgvSPa8AtrCCYk wZommv2xvoRu2Bh2jwitDjC9i+cwCi4bZGppnlBEJY7ybTUACyEOx+EHaxuw1oLH87Kc 1cDeU6kc/H70hfON1XGzgwsAphDcuKRFY2OwM= Received: by 10.223.114.19 with SMTP id c19mr2943430faq.29.1285300264506; Thu, 23 Sep 2010 20:51:04 -0700 (PDT) Received: from localhost ([95.69.171.82]) by mx.google.com with ESMTPS id a6sm742210faa.20.2010.09.23.20.51.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 23 Sep 2010 20:51:03 -0700 (PDT) From: Mikolaj Golub To: freebsd-fs@freebsd.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) Date: Fri, 24 Sep 2010 06:51:02 +0300 Message-ID: <86mxr7x0ih.fsf@kopusha.home.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Subject: hastd: memory leaks if fork() fails X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 03:51:06 -0000 --=-=-= Hi, Although it is rather unlikely situation but anyway :-) If fork() fails in hook_execv() hastd leaks some bytes referred by hp. See the attached patch. -- Mikolaj Golub --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=hooks.c.patch Index: sbin/hastd/hooks.c =================================================================== --- sbin/hastd/hooks.c (revision 213027) +++ sbin/hastd/hooks.c (working copy) @@ -388,6 +388,7 @@ hook_execv(const char *path, va_list ap) switch (pid) { case -1: /* Error. */ pjdlog_errno(LOG_ERR, "Unable to fork to execute %s", path); + hook_free(hp); return; case 0: /* Child. */ descriptors(); --=-=-=--