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 <[email protected]>
Signed-off-by: Zhiqiang Liu <[email protected]>
Signed-off-by: Wu Bo <[email protected]>
---
 utils/fwparam_ibft/fwparam_ppc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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;
 }
-- 
2.27.0

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/20201207015410.48488-13-haowenchao%40huawei.com.

Reply via email to