mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-27 15:56:54 +00:00
dm: fix some potential memory leaks
This patch is to fix some potential memory leak issues 1, free mrp if the mmio_rb_lookup() function return 0; 2, free memory allocated by strdup in some error case handling. Tracked-On: #3277 Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
b65489c27d
commit
0c0371fc9e
@ -265,7 +265,7 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp)
|
||||
struct mmio_rb_range *entry, *mrp;
|
||||
int err;
|
||||
|
||||
err = 0;
|
||||
err = -1;
|
||||
|
||||
mrp = malloc(sizeof(struct mmio_rb_range));
|
||||
|
||||
@ -280,8 +280,7 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp)
|
||||
pthread_rwlock_unlock(&mmio_rwlock);
|
||||
if (err)
|
||||
free(mrp);
|
||||
} else
|
||||
err = -1;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -3997,6 +3997,8 @@ errout:
|
||||
free(xdev->portregs);
|
||||
xdev->portregs = NULL;
|
||||
}
|
||||
if (rc < -2 && s)
|
||||
free(s);
|
||||
UPRINTF(LFTL, "fail to parse xHCI options, rc=%d\r\n", rc);
|
||||
|
||||
if (opts)
|
||||
|
Loading…
Reference in New Issue
Block a user