Fix abd_get_offset_struct() may allocate new abd
Even when supplied with an abd to abd_get_offset_struct(), the call to abd_get_offset_impl() can allocate a different abd. Ensure to call abd_fini_struct() on the abd that is not used. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Jorgen Lundman <lundman@lundman.net> Closes #11683
This commit is contained in:
parent
ba74de88c0
commit
8a6d444825
|
@ -555,8 +555,12 @@ abd_get_offset_impl(abd_t *abd, abd_t *sabd, size_t off, size_t size)
|
||||||
abd_t *
|
abd_t *
|
||||||
abd_get_offset_struct(abd_t *abd, abd_t *sabd, size_t off, size_t size)
|
abd_get_offset_struct(abd_t *abd, abd_t *sabd, size_t off, size_t size)
|
||||||
{
|
{
|
||||||
|
abd_t *result;
|
||||||
abd_init_struct(abd);
|
abd_init_struct(abd);
|
||||||
return (abd_get_offset_impl(abd, sabd, off, size));
|
result = abd_get_offset_impl(abd, sabd, off, size);
|
||||||
|
if (result != abd)
|
||||||
|
abd_fini_struct(abd);
|
||||||
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
abd_t *
|
abd_t *
|
||||||
|
|
Loading…
Reference in New Issue