[dm-devel] dm: Fixes memory leak in setup_indexes function

Mike Snitzer snitzer at redhat.com
Fri Aug 6 12:29:21 UTC 2010


On Fri, Aug 06 2010 at  5:36am -0400,
Shahzad Hussain Bangash <ext-shahzad.bangash at nokia.com> wrote:

> Sorry for multiple patches. This patch fixes memory leak in
> setup_indexes function where memory is allocated for indexes pointer by
> dm_vcalloc with the size of NODE_size and is not freed after that
> through the end of the function.

There isn't a leak.

The 2nd loop's "t->index[i] = indexes;" takes ownership of the
dm_vcalloc'd memory.  dm_table_destroy() will later free that memory.

Your patch actually introduces a use after free bug.

Regards,
Mike




More information about the dm-devel mailing list