1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: make dm_stats_destroy(NULL) a no-op

Test for NULL in dm_stats_destroy() and return immediately if
the struct dm_stats pointer is NULL (similar to free(NULL)).

This simplifies cleanup code which otherwise needs to:

  out:
    if (dms)
        dm_stats_destroy(dms);
    return;
This commit is contained in:
Bryn M. Reeves 2017-03-10 16:41:28 +00:00
parent 93644be44b
commit d28a50ec76

View File

@ -2387,6 +2387,9 @@ bad:
*/ */
void dm_stats_destroy(struct dm_stats *dms) void dm_stats_destroy(struct dm_stats *dms)
{ {
if (!dms)
return;
_stats_regions_destroy(dms); _stats_regions_destroy(dms);
_stats_groups_destroy(dms); _stats_groups_destroy(dms);
_stats_clear_binding(dms); _stats_clear_binding(dms);