iwlwifi: dbg_ini: fix memory leak in alloc_sgtable
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Fri, 13 Sep 2019 04:23:27 +0000 (23:23 -0500)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 9 Oct 2019 10:01:06 +0000 (13:01 +0300)
In alloc_sgtable if alloc_page fails, the alocated table should be
released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dbg.c

index 5c8602d..8742180 100644 (file)
@@ -646,6 +646,7 @@ static struct scatterlist *alloc_sgtable(int size)
                                if (new_page)
                                        __free_page(new_page);
                        }
+                       kfree(table);
                        return NULL;
                }
                alloc_size = min_t(int, size, PAGE_SIZE);