Commit 8bc69f8
Drivers: hv: vmbus: Fix memory leak in vmbus_add_channel_kobj
kobject_init_and_add() takes reference even when it fails.
According to the doc of kobject_init_and_add():
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object.
Fix memory leak by calling kobject_put().
Fixes: c2e5df6 ("vmbus: add per-channel sysfs info")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Juan Vazquez <juvazq@linux.microsoft.com>
Link: https://lore.kernel.org/r/20220203173008.43480-1-linmq006@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>1 parent 3149efc commit 8bc69f8
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2028 | 2028 | | |
2029 | 2029 | | |
2030 | 2030 | | |
2031 | | - | |
| 2031 | + | |
| 2032 | + | |
2032 | 2033 | | |
| 2034 | + | |
2033 | 2035 | | |
2034 | 2036 | | |
2035 | 2037 | | |
| |||
2038 | 2040 | | |
2039 | 2041 | | |
2040 | 2042 | | |
| 2043 | + | |
2041 | 2044 | | |
2042 | 2045 | | |
2043 | 2046 | | |
| |||
0 commit comments