diff options
author | Wenchao Hao <haowenchao@huawei.com> | 2020-12-03 11:12:37 +0800 |
---|---|---|
committer | Wenchao Hao <haowenchao@huawei.com> | 2020-12-12 11:44:37 +0800 |
commit | f4006107c07a7610aa9b32b538726de6d0e109b5 (patch) | |
tree | 7ade0552e27dcb0219cc5cb919b19f24288341b3 /utils | |
parent | 289e2b96a5febce1fe10eb3a61d052f1878ae2a9 (diff) | |
download | open-iscsi-f4006107c07a7610aa9b32b538726de6d0e109b5.tar.gz |
fwparam_ppc: Fix memory leak in fwparam_ppc.c
calloc() is called because loop_devs() to allocate memory
which stored in array ofwdev. These memory should be freed
at the end.
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Wu Bo <wubo40@huawei.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/fwparam_ibft/fwparam_ppc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/fwparam_ibft/fwparam_ppc.c b/utils/fwparam_ibft/fwparam_ppc.c index 6a45b8c..da9d76e 100644 --- a/utils/fwparam_ibft/fwparam_ppc.c +++ b/utils/fwparam_ibft/fwparam_ppc.c @@ -446,6 +446,7 @@ int fwparam_ppc_boot_info(struct boot_context *context) char filename[FILENAMESZ]; int error; char *devtree; + int i; /* * For powerpc, our operations are fundamentally to locate @@ -511,6 +512,10 @@ free_bootpath_val: free_devtree: free(devtree); + for (i = 0; i < dev_count; i++) + if (ofwdevs[i]) + free(ofwdevs[i]); + return error; } @@ -525,6 +530,7 @@ int fwparam_ppc_get_targets(struct list_head *list) struct boot_context *context; int error; char *devtree; + int i; /* * For powerpc, our operations are fundamentally to locate @@ -592,5 +598,9 @@ free_bootpath_val: free_devtree: free(devtree); + for (i = 0; i < dev_count; i++) + if (ofwdevs[i]) + free(ofwdevs[i]); + return error; } |