Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3440979ioo; Mon, 30 May 2022 02:03:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXpaHuFfzZBDIp7jKrMdMzWILg90oKd/mlfxhYoqmGZYAysh8iSc2K+ATgbgpj8mkv1SGj X-Received: by 2002:a05:6402:5191:b0:42d:d6cb:d18c with SMTP id q17-20020a056402519100b0042dd6cbd18cmr1346993edd.11.1653901433561; Mon, 30 May 2022 02:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653901433; cv=none; d=google.com; s=arc-20160816; b=J9nJtGB2cAGw9nAHswMMCP3ZyR4uX3idBeo7Ol3VGbygwy+hCAirwtFFoOTNuL1BGA lstKKRJqq8OCG0HSiYTtdqCgUN1Lb8aCeFqArPpqH3BWkCkAnmHSy2kAfXKrv/QbsBs8 OXHv1VeRbgHR2KNNRTCPi8/lZz/ZlG4Rgp0V7OZgRYrxgdGAO3PKvLjE1bdJkEwPxFPg Netspyuo/eIowtEvsSulDY5TublxrZqw7uiWrVcUb3zHcgRfl8ZSldVTvRM1BJrONQxr LGJnszBHnAaY1ab8RygytwUmmO4wnPuMvTqoE6N1EUeh3/umLAUH3jUCjsqmy4stm4ar Dglw== 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=gL4zVaeTglF2Q53Ox/3bbmZfF3gTjJAaDfHko8l4Lao=; b=iBYONh1YjYmxfNy8ouusw0kveArj5p4AjN73bc6niIHV6oMuq8grMq2hC1rklumViO QyPTYlq8QaNsKnrx1ascjwPZSl+6bh3BSCJUdQke0UlhWN092JIh2KMye5nxBqXddPdW K4CZNrAqm1OLmUmb7HRt47lILegJc1eF/YD0DV+/+cD10Sfca1U/eyfLUzlegYMFdKsF +T7Pv3M7def2YteQYCkFQ/k+KBUKx9bB54FS6U+CCNHe+p0YBlwHH2Zg3WhbXpxGFYEj rSiUjcGqY+w2wrQ7gABm22vx92Edr3q7UnkKzIlA5ccfh5r5dpMzWYyYmbCBPzTvJ3sL Xpng== 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 w24-20020aa7cb58000000b0042dca73c675si4150827edt.269.2022.05.30.02.03.25; Mon, 30 May 2022 02:03:53 -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 S233231AbiE3ING (ORCPT + 99 others); Mon, 30 May 2022 04:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233180AbiE3IM6 (ORCPT ); Mon, 30 May 2022 04:12:58 -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 1C66C7629A for ; Mon, 30 May 2022 01:12:55 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-449-6Mi8KDGLPYCKCEwxUFlBNQ-1; Mon, 30 May 2022 04:12:51 -0400 X-MC-Unique: 6Mi8KDGLPYCKCEwxUFlBNQ-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 2F58980013E; Mon, 30 May 2022 08:12:51 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.64.242.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 075AC1410F36; Mon, 30 May 2022 08:12:48 +0000 (UTC) From: Gopal Tiwari To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, gtiwari@redhat.com Subject: [Bluez 11/13] Fixing memory leak in pbap.c Date: Mon, 30 May 2022 13:42:07 +0530 Message-Id: <20220530081209.560465-12-gopalkrishna.tiwari@gmail.com> In-Reply-To: <20220530081209.560465-1-gopalkrishna.tiwari@gmail.com> References: <20220530081209.560465-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..98e337ea1 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