Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp368189lqo; Fri, 10 May 2024 02:18:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCURozvwpdthZaX9Jkage+oyQvOlxfOo/yQz5IvTiaFTYn04deEp7b/ot/h+jrhSR7yBBz6nDOAEC6p7fhO0ASKwNoWUMBZgRU3PO+unbA== X-Google-Smtp-Source: AGHT+IEolO+4BFXVLKiF7pn2VmaeO54BzGWO1V4+IUoWTMyUB3KKmpgFTlm1UZFm51lenCzZYdT/ X-Received: by 2002:a05:622a:34a:b0:439:a519:7ceb with SMTP id d75a77b69052e-43dfdab4356mr18105891cf.25.1715332722987; Fri, 10 May 2024 02:18:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715332722; cv=pass; d=google.com; s=arc-20160816; b=p7sgsRPSk+ztRINWiEKJX0L2y2abJax+00fthEqZxQmuLUj9qirFkUBRdjGb4l5DiG wxFYC0RBdC55zsub9bVAA2TOdgMO+0NYKIFJAm+K82CjSNNK94eExUdEH0Xesdpz6jm9 8Bct6e+RvUuBLQGuLCumpKhkogD5WZlPzOH8g4IOFn2IGCMkyWYbBd6TgFJyZhnnBnK3 /HsVZZUjzpOvrK4NzNP4GZKzBItAwtZuKGca3J318nJpP9HIUmML6gGQFCMPyZ55Sc3Q PLl2gVVgs/GwvHjAnP959TAn7S3gSK4ZEtLTvlt7QsYqGcv9RGa6d7KlNYwntgZksd1g 6tyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from; bh=hNhoLqqzogug6O1gn3HAIOb86MmK9ncIM4dYBFffVGc=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=a5c5bbe5e+KUdhw5/uq3Z2b7/FtuAebaclCXsGrBFSkJeMw0iYM7D5FlZTCgVzPWBN d0i5KHh9nYV1jmV9/jxwMeKzOhJwd19hhy2IkWJA3PL0/8JNhgHtC/0SUIxxGiJs3tno y2ATMtuO+nfhmr1ik2DKxLsi0V4NS8gmSjSbu/ZE6gwAPeYE+4icvFZYaIeGjlvE1zJe Guq5Q0B7JM5DzauhR/4j7joJPLMqF84fDLSJ8oHfZ6pVxObah6JAs4fGqROsas5DJ6Vr FjGr2Np4JOsCytseZlggCQd3eEQ5QxAUb80C6l1HhyFbXNf1DgkrieCen8ONR6vT0/E7 dWlg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4448-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4448-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df56afb1fsi30157431cf.557.2024.05.10.02.18.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4448-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4448-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4448-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CE1761C221E8 for ; Fri, 10 May 2024 09:18:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52771165FBA; Fri, 10 May 2024 09:18:25 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 379971635CB for ; Fri, 10 May 2024 09:18:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715332705; cv=none; b=G3gB05weCdk4gzvuhi1+vV7SRHaU7BjHaTMXWZkxQ1vQ+hpIogKTpWyjL9Kz2F/ub9gthRgRqPMCwwYgu4rKcHmGbdsSAyDQMkdos+aNkADGghAfQBHY/yaXxz1jC5SdO7HOZujmioR58l8MO3C/7/21optSQBilzmUGJfG+4Dw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715332705; c=relaxed/simple; bh=F9aBXHTyJ8yCD7egItUeFRNE5MgkR7fAK7lVYebRWgM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fGcVRMh1FF4Poclo6bQEWiFtIoQtpUF3q5ZU51liwNwdSQ4XXQnHLgBq+duNMFjHksosGxipWLM372PPjevpmRDqeo2xZwbJJD+3PifNCm2n+LngAQaJRMl+hTUAkZ4QvBRZeAE2L6vy+xzyEV9F3fWefyrzWaA2W1jbIcnf2Xs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hadess.net; spf=pass smtp.mailfrom=hadess.net; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hadess.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hadess.net Received: by mail.gandi.net (Postfix) with ESMTPSA id 863B61BF207 for ; Fri, 10 May 2024 09:18:16 +0000 (UTC) From: Bastien Nocera To: linux-bluetooth@vger.kernel.org Subject: [BlueZ 06/14] client/main: Fix mismatched free Date: Fri, 10 May 2024 11:11:04 +0200 Message-ID: <20240510091814.3172988-7-hadess@hadess.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240510091814.3172988-1-hadess@hadess.net> References: <20240510091814.3172988-1-hadess@hadess.net> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: hadess@hadess.net Error: ALLOC_FREE_MISMATCH (CWE-762): [#def37] bluez-5.75/client/main.c:2108:2: alloc: Allocation of memory which must be freed using "g_free". bluez-5.75/client/main.c:2108:2: assign: Assigning: "desc" = "g_strdup_printf("\x1b[0;94m[%s]\x1b[0m# ", attr)". bluez-5.75/client/main.c:2111:2: free: Calling "free" frees "desc" using "free" but it should have been freed using "g_free". 2109| 2110| bt_shell_set_prompt(desc); 2111|-> free(desc); 2112| } 2113| --- client/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.c b/client/main.c index f703cc91b24a..f967c149e7bd 100644 --- a/client/main.c +++ b/client/main.c @@ -2113,7 +2113,7 @@ static void set_default_local_attribute(char *attr) desc = g_strdup_printf(COLOR_BLUE "[%s]" COLOR_OFF "# ", attr); bt_shell_set_prompt(desc); - free(desc); + g_free(desc); } static void cmd_select_attribute(int argc, char *argv[]) -- 2.44.0