From patchwork Sun Sep 20 09:01:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 255736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24C99C43466 for ; Sun, 20 Sep 2020 09:01:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE7F320EDD for ; Sun, 20 Sep 2020 09:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726279AbgITJBl (ORCPT ); Sun, 20 Sep 2020 05:01:41 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:33134 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbgITJBl (ORCPT ); Sun, 20 Sep 2020 05:01:41 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 0ABE51C0B94; Sun, 20 Sep 2020 11:01:39 +0200 (CEST) Date: Sun, 20 Sep 2020 11:01:37 +0200 From: Pavel Machek To: stefanr@s5r6.in-berlin.de, mchehab@kernel.org, linux-media@vger.kernel.org, linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] media: firewire: fix memory leak Message-ID: <20200920090137.GA4628@amd> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Fix memory leak in node_probe. Signed-off-by: Pavel Machek (CIP) diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c index 3f1ca40b9b98..8a8585261bb8 100644 --- a/drivers/media/firewire/firedtv-fw.c +++ b/drivers/media/firewire/firedtv-fw.c @@ -272,8 +272,10 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) name_len = fw_csr_string(unit->directory, CSR_MODEL, name, sizeof(name)); - if (name_len < 0) - return name_len; + if (name_len < 0) { + err = name_len; + goto fail_free; + } for (i = ARRAY_SIZE(model_names); --i; ) if (strlen(model_names[i]) <= name_len && strncmp(name, model_names[i], name_len) == 0)