staging: rtl8712: fix potential memory leak
authorNam Cao <namcaov@gmail.com>
Tue, 25 Oct 2022 09:12:26 +0000 (11:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 31 Oct 2022 08:08:30 +0000 (09:08 +0100)
commit336ccc31cda111c830332d4b56def49c9c1d48e6
tree6796b56a9d70106f1272d1614cf131c6c171bd9d
parent242443430dd8ef932a56cf483080a46f2948dd65
staging: rtl8712: fix potential memory leak

In r8712_init_drv_sw(), whenever any function call returns error, it is
returned immediately without properly cleaning up the other successfully
executed functions. This can cause memory leak.

Instead of return immediately, free all the allocated buffers first.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Nam Cao <namcaov@gmail.com>
Link: https://lore.kernel.org/r/0a3414b12031f6cdcba81a8725e91eb9567ff34f.1666688642.git.namcaov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/os_intfs.c