net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()'

If this 'kzalloc()' fails we must free some resources as in all the other
error handling paths of this function.

Fixes: 2e2deee761 ("net: hns3: add the RAS compatibility adaptation solution")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Jiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christophe JAILLET 2021-06-20 11:49:40 +02:00 коммит произвёл David S. Miller
Родитель ebe9d9eb9c
Коммит b40d7af798
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -2330,8 +2330,10 @@ int hclge_handle_error_info_log(struct hnae3_ae_dev *ae_dev)
buf_size = buf_len / sizeof(u32); buf_size = buf_len / sizeof(u32);
desc_data = kzalloc(buf_len, GFP_KERNEL); desc_data = kzalloc(buf_len, GFP_KERNEL);
if (!desc_data) if (!desc_data) {
return -ENOMEM; ret = -ENOMEM;
goto err_desc;
}
buf = kzalloc(buf_len, GFP_KERNEL); buf = kzalloc(buf_len, GFP_KERNEL);
if (!buf) { if (!buf) {