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: 11787387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4B466CB for ; Sun, 20 Sep 2020 09:01:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4F5E214F1 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)