From patchwork Fri Apr 16 12:21:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 93145 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3GCLbZb007801 for ; Fri, 16 Apr 2010 12:21:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758351Ab0DPMVh (ORCPT ); Fri, 16 Apr 2010 08:21:37 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:45763 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758343Ab0DPMVg (ORCPT ); Fri, 16 Apr 2010 08:21:36 -0400 Received: by wwb24 with SMTP id 24so1108856wwb.19 for ; Fri, 16 Apr 2010 05:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=OLCwvUOaEBVpnv5AkCaF8jsIR9bg6cjqrbbSKu0R26I=; b=I1nVFQfm7aOd8OuLmeHix6ZxhHWTjMV+z7rff7WiF9jpJH1AmeT4zN3zA/fFgUopC2 f/ZO+4M1+dx4k0C1jOeCb6jJ1XNlteHn3CQlCnkO6xD9GdI9/3R0tNctnBewGX6JHUTh Db4xCwPpwaBy+H6UPb/9Fsq1UNvSly0pShcHY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=q8FaYTtWJugWc2qz1ULi0x7VRvwZRr3u2I4Avb7TtXQSFAb7KaGl905Oq22M4I1TYl dAPATvBVJvWaMT98o163JpOdzDlpUUjiFJFZGtRJQh0hSZC+VVDieBLCHIAze8k3qOVu B2soVJ0qw3FJ2SjKYjkX6OV+QAtMviy3T5RxE= Received: by 10.216.171.145 with SMTP id r17mr1678148wel.182.1271420494723; Fri, 16 Apr 2010 05:21:34 -0700 (PDT) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id z34sm20635610wbv.2.2010.04.16.05.21.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Apr 2010 05:21:34 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id 69E2711F31; Fri, 16 Apr 2010 15:21:51 +0300 (IDT) Date: Fri, 16 Apr 2010 15:21:51 +0300 From: Sasha Khapyorsky To: Ira Weiny Cc: "linux-rdma@vger.kernel.org" , Hal Rosenstock Subject: [PATCH] libibnetdisc: fix memory leak in case of send_smps() failure Message-ID: <20100416122151.GC11943@me> References: <20100218124933.c018a23d.weiny2@llnl.gov> <20100413163836.GM10830@me> <20100413133826.00a8afc5.weiny2@llnl.gov> <20100413134446.72eb336a.weiny2@llnl.gov> <20100414102335.GT10830@me> <0EEE4F40-F1DD-46A6-B756-3C46DA06B403@llnl.gov> <20100416120505.GB11943@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100416120505.GB11943@me> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 16 Apr 2010 12:21:38 +0000 (UTC) diff --git a/infiniband-diags/libibnetdisc/src/query_smp.c b/infiniband-diags/libibnetdisc/src/query_smp.c index 08e3ef7..e5a8f06 100644 --- a/infiniband-diags/libibnetdisc/src/query_smp.c +++ b/infiniband-diags/libibnetdisc/src/query_smp.c @@ -96,8 +96,10 @@ static int process_smp_queue(smp_engine_t * engine) if (!smp) return 0; - if ((rc = send_smp(smp, engine->ibmad_port)) != 0) + if ((rc = send_smp(smp, engine->ibmad_port)) != 0) { + free(smp); return rc; + } engine->num_smps_outstanding++; cl_qmap_insert(&engine->smps_on_wire, (uint32_t) smp->rpc.trid, (cl_map_item_t *) smp);