media: firewire: fix memory leak
authorPavel Machek <pavel@ucw.cz>
Sun, 20 Sep 2020 09:01:37 +0000 (11:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:05:41 +0000 (09:05 +0100)
[ Upstream commit b28e32798c78a346788d412f1958f36bb760ec03 ]

Fix memory leak in node_probe.

Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/firewire/firedtv-fw.c

index 5d63470..382f290 100644 (file)
@@ -271,8 +271,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)