bus/fslmc: fix error handling in device iterator
authorHemant Agrawal <hemant.agrawal@nxp.com>
Wed, 17 Jul 2019 15:55:18 +0000 (21:25 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 17 Jul 2019 17:47:20 +0000 (19:47 +0200)
When initializing EAL with "-w 0:0.0", this error is blocking:
munmap_chunk(): invalid pointer
ElectricFence reports this root cause:
free(7fffeec25a11): address not from malloc()

Fixes: e67a61614d0b ("bus/fslmc: support device iteration")

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Thomas Monjalon <thomas@monjalon.net>
drivers/bus/fslmc/fslmc_bus.c

index a2ed3bc..9e4146a 100644 (file)
@@ -296,7 +296,7 @@ jump_out:
 
        return 0;
 err_out:
-       if (sep)
+       if (!sep_exists && sep)
                free(sep);
        return -EINVAL;
 }