From patchwork Fri Jan 11 06:37:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 1023408 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tkh3duRO"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43bY9K0cjSz9sCh for ; Fri, 11 Jan 2019 17:38:45 +1100 (AEDT) Received: from localhost ([127.0.0.1]:54345 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghqSo-0002gl-U7 for incoming@patchwork.ozlabs.org; Fri, 11 Jan 2019 01:38:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghqSB-0002eu-RB for qemu-devel@nongnu.org; Fri, 11 Jan 2019 01:38:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghqS9-0007gK-NH for qemu-devel@nongnu.org; Fri, 11 Jan 2019 01:38:03 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:46000) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghqS9-0007dk-9i for qemu-devel@nongnu.org; Fri, 11 Jan 2019 01:38:01 -0500 Received: by mail-pl1-x634.google.com with SMTP id a14so6316509plm.12 for ; Thu, 10 Jan 2019 22:37:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EaEm7GhKPLbm8j7I19095wyJJWd37TUtwImyNV9Ffpw=; b=tkh3duRO6nuUWaTs25iLN/Fb1O3BUz89l/vxM97eUGMtyS5k2qfgxVO+Xi0E/jkF0K cOSbw2cfy6fLF7i5AG4HoYRqtf2RYMKKxRiQrKm0REvGNZnZQ3qytdL/l8Q3ml3ar3oC 9J8IKxM6VkziJaL3tkxCP7ujn2LdXmTBFWCLUaAvXg8U36lqMZ+jvbtcuG82ghJBra9z kyw4LFRJOKhl9wtLS4yrh6Mfzn6MbBevqsOA0F3z2RlW+a6EqQEANI9c+yNQLeyz1W/k yuRmoWLPgpnOw7m04VXc5+gv8kk1pWYsqDlsrfOHnewbwvrw5NevTjW+4Mx/NvsT/U5x MUcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EaEm7GhKPLbm8j7I19095wyJJWd37TUtwImyNV9Ffpw=; b=S1mEpH6dv6X9YyykyDxbinzexMh0JeUzQ1wstlt2mREGFdeKqsMNKT3ab7pt+Ohrdh 48kTiTmMNMe+C/dkZ13NiijM6Eg2rdVnA7VmK9Eu2omE+SKNWP6CrPqUXo3NuNnL/oXH oH9n+9rhQcMMMBhXJ5kcTML9Nc031sBMGXFk74qjXaDZR3l1qpBVlARxKl/KKigViaO3 Kluep0kY3T4iJT1T76Q/QBgvAhuAvzhb2rWeZEDy4iA550+cE9CxQ6KRbJ2iyVxLtUZ8 Z1ciLq8L1DxAh4uk3NHXETZQugW7ETmuVduuWUoWoodB89+74q2I5DxHCS3sjANWGI9k 07Dg== X-Gm-Message-State: AJcUukedYvtL8lvtXPjmKqdbjNUgao9l51Il5NfpbdIkJ307HcAmQXQR LmWWMjqTsuCLeHZp1Ow/OX4= X-Google-Smtp-Source: ALg8bN63YWcQNfj+sMHNFX2B3oEp62u/Y/ZVIgH5NNUFqH0ne4ue/kHwigepgVVSasTo7YW2+IyB7A== X-Received: by 2002:a17:902:34a:: with SMTP id 68mr13751093pld.268.1547188676338; Thu, 10 Jan 2019 22:37:56 -0800 (PST) Received: from localhost.localdomain ([203.205.141.36]) by smtp.gmail.com with ESMTPSA id 78sm141460933pft.184.2019.01.10.22.37.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 22:37:55 -0800 (PST) From: guangrong.xiao@gmail.com X-Google-Original-From: xiaoguangrong@tencent.com To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com Date: Fri, 11 Jan 2019 14:37:31 +0800 Message-Id: <20190111063732.10484-3-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20190111063732.10484-1-xiaoguangrong@tencent.com> References: <20190111063732.10484-1-xiaoguangrong@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::634 Subject: [Qemu-devel] [PATCH v2 2/3] migration: fix memory leak when updating tls-creds and tls-hostname 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: kvm@vger.kernel.org, quintela@redhat.com, Xiao Guangrong , qemu-devel@nongnu.org, peterx@redhat.com, dgilbert@redhat.com, wei.w.wang@intel.com, cota@braap.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Xiao Guangrong If we update parameter, tls-creds and tls-hostname, these string values are duplicated to local variables in migrate_params_test_apply() by using g_strdup(), however these new allocated memory are missed to be freed Actually, they are not used to check anything, we can directly skip them Signed-off-by: Xiao Guangrong --- migration/migration.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a82d594f29..fb39d7bec1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1145,16 +1145,6 @@ static void migrate_params_test_apply(MigrateSetParameters *params, dest->cpu_throttle_increment = params->cpu_throttle_increment; } - if (params->has_tls_creds) { - assert(params->tls_creds->type == QTYPE_QSTRING); - dest->tls_creds = g_strdup(params->tls_creds->u.s); - } - - if (params->has_tls_hostname) { - assert(params->tls_hostname->type == QTYPE_QSTRING); - dest->tls_hostname = g_strdup(params->tls_hostname->u.s); - } - if (params->has_max_bandwidth) { dest->max_bandwidth = params->max_bandwidth; }