From patchwork Fri Dec 24 22:01:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 432431 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBOMBQ9B018974 for ; Fri, 24 Dec 2010 22:11:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753056Ab0LXWLF (ORCPT ); Fri, 24 Dec 2010 17:11:05 -0500 Received: from swampdragon.chaosbits.net ([90.184.90.115]:22275 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753022Ab0LXWLE (ORCPT ); Fri, 24 Dec 2010 17:11:04 -0500 Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id 787B59403D; Fri, 24 Dec 2010 23:01:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id 71F249403B; Fri, 24 Dec 2010 23:01:12 +0100 (CET) Date: Fri, 24 Dec 2010 23:01:12 +0100 (CET) From: Jesper Juhl To: ceph-devel@vger.kernel.org cc: linux-kernel@vger.kernel.org, "David S. Miller" , netdev@vger.kernel.org, Sage Weil Subject: [PATCH] ceph: Always free allocated memory in osdmap_decode() Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 24 Dec 2010 22:11:27 +0000 (UTC) diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index d73f3f6..71603ac 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -605,8 +605,10 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) goto bad; } err = __decode_pool(p, end, pi); - if (err < 0) + if (err < 0) { + kfree(pi); goto bad; + } __insert_pg_pool(&map->pg_pools, pi); }