Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4453030ioo; Tue, 31 May 2022 05:01:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcbL4osk7wXlKfZS5ewMQ+XSvrNcH+vsvw8jnE+DADfYGLmFwLpS/tvbrBZirl/C7/2BjK X-Received: by 2002:a17:907:2d94:b0:6ff:601:679f with SMTP id gt20-20020a1709072d9400b006ff0601679fmr32176726ejc.109.1653998465069; Tue, 31 May 2022 05:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653998465; cv=none; d=google.com; s=arc-20160816; b=SmWyqddgKlmOoZjdRNAtF8yv/BV2xmClB3NVdEoLUVbCblr9am7vqYB2+AoBlU0NeV JWmDtNt5tcMgpoSkeu6zLe1QIVBdkcELhYnQQp86coDoaGZPqKsVo65b9CmuKCgVk6Uo Gpz0fK4VBOkVnKkwpiZFl7Y3aWs2y42fsSJxcgkP+9+pLv1XomN7cK0Lde/espoDPSJ1 GmZZL44yGZGnO0KbMz/49PPuEltjsjck3XzMyHXWVZ6h61n51CotD6qg39ekNaUn7mWU tbVMTMfrj8CoysEdheFDwQOzVrl726r+ehGIsNzwsje4bFdys6Z4FqH7MxxOrNl+cWf3 QSRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NOMXwgaNz8fBEaHkxNItKkV+acAObanwgy5ptX+UkbI=; b=h6ClCf6SzXbJcBPpO+++7QjuJg3GSPFujQ0EaXDU7ECNb7jqUcyve6bTTEFE/eiBF7 qiz6zfmaOw2R9fvZcg2TCVvyO6VZZY1S+NxVtTFHMBvShzP6s3y/lrkysW87khBADnX4 T/PeKJEqo1LPuN4xlPADtJFbNpVZQRLIn2LF0jliEX31G3W0VxFIKRle9CdJkHRihiJi L0Fpl/3ZljQZc7poI8RCINz+/Eggiw2ogomP3SZ3+XlH1x2OR2/jcnl6XwSuoovE8WTJ QwFMvS1Ad1OxenA0YyFEMce9EKg9rnATHjBf5U/pnNCQ8xXheFYzuD7Y8eu53lyDoxpO jUDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a50eacb000000b00423e1efca48si11721511edp.198.2022.05.31.05.00.25; Tue, 31 May 2022 05:01:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244587AbiEaHmN (ORCPT + 99 others); Tue, 31 May 2022 03:42:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244583AbiEaHmF (ORCPT ); Tue, 31 May 2022 03:42:05 -0400 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [207.211.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 67F00140C1 for ; Tue, 31 May 2022 00:42:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-505-0oHKXtoTPhyG3Lw_9NdErQ-1; Tue, 31 May 2022 03:42:00 -0400 X-MC-Unique: 0oHKXtoTPhyG3Lw_9NdErQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 194293C138A4; Tue, 31 May 2022 07:42:00 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.64.242.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DC421415100; Tue, 31 May 2022 07:41:56 +0000 (UTC) From: Gopal Tiwari To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, gtiwari@redhat.com Subject: [Bluez V2 11/13] Fixing memory leak in pbap.c Date: Tue, 31 May 2022 13:11:15 +0530 Message-Id: <20220531074117.610321-12-gopalkrishna.tiwari@gmail.com> In-Reply-To: <20220531074117.610321-1-gopalkrishna.tiwari@gmail.com> References: <20220531074117.610321-1-gopalkrishna.tiwari@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Gopal Tiwari Reported by coverity tool as follows: bluez-5.64/obexd/client/pbap.c:929: leaked_storage: Variable "apparam" going out of scope leaks the storage it points to. Signed-off-by: Gopal Tiwari --- obexd/client/pbap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c index 1a2bacc9f..1ed8c68ec 100644 --- a/obexd/client/pbap.c +++ b/obexd/client/pbap.c @@ -925,10 +925,11 @@ static DBusMessage *pbap_search(DBusConnection *connection, return g_dbus_create_error(message, ERROR_INTERFACE ".InvalidArguments", NULL); - if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING) + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING) { + g_obex_apparam_free(apparam); return g_dbus_create_error(message, ERROR_INTERFACE ".InvalidArguments", NULL); - + } dbus_message_iter_get_basic(&args, &value); dbus_message_iter_next(&args); -- 2.26.2