From patchwork Mon Jul 23 20:17:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 10540977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FBB0112E for ; Mon, 23 Jul 2018 21:02:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FF7D284B3 for ; Mon, 23 Jul 2018 21:02:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3413E284C0; Mon, 23 Jul 2018 21:02:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CFF63284B3 for ; Mon, 23 Jul 2018 21:02:12 +0000 (UTC) Received: from localhost ([::1]:36604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhy8-0005Mo-1j for patchwork-qemu-devel@patchwork.kernel.org; Mon, 23 Jul 2018 17:02:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhJp-000352-Df for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhJo-0004no-Lh for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:33 -0400 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:38991) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhJo-0004mx-GD; Mon, 23 Jul 2018 16:20:32 -0400 Received: by mail-oi0-x243.google.com with SMTP id d189-v6so3483148oib.6; Mon, 23 Jul 2018 13:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=pCq8sAqdtI4nyjBJlEXAu9mUe3sKLCYPjSfPiiWudy0=; b=A0Xqk0IrbyJzaGg0fGd+AkhbHb9fWO7YcJXKbJxtwQHJFptNynb4+zjpHmWrJroy2B 3iUCmE+hXISzOm89PbjS9wQDkJcV7Z0Y7T3z8BTvHthKcT35/fdjrwDrwE8gqbmZ2kNg e9CEPgaaUEgA+l6YfL4wgIEd03wn9bz7hWM7WvUHHmRbfX45xEDbZQ4bGVuUBA7dM/gu /8+zRhtGu7Va7rlAbWm2vwDo66fkRcEYRNfDA6Anc0AwLVegrL2uz9lHGLm8dK0A42Mx rD19cJRqLyx51HANOD17zIWRqQkA6OWt8qe/zPHEfKjprKXsvnHXtUnwEMq2AxZRcx1E gL1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=pCq8sAqdtI4nyjBJlEXAu9mUe3sKLCYPjSfPiiWudy0=; b=KMzHBpZ4Xnt3FIjDOAYM2lk4CpveJI0ng6oSsLw7kmWZHBcKbUhPG/Rl+LVnZrG3Ff lwzLurN+chLAyPL/4DoeO4m0xEFzIqojCwLYvZzz5OSaTMSdbYcWak6uVYlZM9CxxegQ dCJm7Z3atIdS+Tn3oW6fCwFt0516tX5HGasS1KN7a3t+tMWav/8nb3E316oJLdnrMpua xfmEdmbYl4PPUCDu2VYcqUNuhbQ7+xwrAMhYAKdp4iaQVNW3RDbQp7TzllK7TRPVB/ME YC8Y5eJiOd7xFS/c4KupxODkt/BVYCDrFtzX6ngYmtJ6/uBdYBUn8iTNa5Zfck4UL2go qiQg== X-Gm-Message-State: AOUpUlECc3EbrER+z5l5cHYkTWszRoPGaBdlFJGrN9wy9ymgktWoAHGw 8cmVQnD2+zi5FzLvwrROe3X191hgU8Y= X-Google-Smtp-Source: AAOMgpdi4mU0fmM5o49iehioSs5apWBNWtUkKJhAPK5/X4+tPNc7eKbWYPzSA7czDZpG5LEQO6PjcQ== X-Received: by 2002:aca:af11:: with SMTP id y17-v6mr291971oie.274.1532377231390; Mon, 23 Jul 2018 13:20:31 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id v5-v6sm1201957oix.36.2018.07.23.13.20.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:20:30 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:05 -0500 Message-Id: <20180723201748.25573-57-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::243 Subject: [Qemu-devel] [PATCH 56/99] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Sementsov-Ogievskiy , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Vladimir Sementsov-Ogievskiy Release buf on error path too. Bug was introduced in b35ebdf076d697bc "migration: add postcopy migration of dirty bitmaps" with the whole function. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20180427142002.21930-3-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake (cherry picked from commit 16a2227893dc1d5cad78ed376ad1d7e300978fbe) Signed-off-by: Michael Roth --- migration/block-dirty-bitmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index dd04f102d8..8819aabe3a 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -600,6 +600,7 @@ static int dirty_bitmap_load_bits(QEMUFile *f, DirtyBitmapLoadState *s) ret = qemu_get_buffer(f, buf, buf_size); if (ret != buf_size) { error_report("Failed to read bitmap bits"); + g_free(buf); return -EIO; }