diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2017-03-10 16:41:28 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-03-10 16:41:28 +0000 |
commit | d28a50ec76c62c48a3be695569fe5e752b9ae684 (patch) | |
tree | 6895650ebb7fbcbe2f08df688903863781927e74 /libdm/libdm-stats.c | |
parent | 93644be44b4067c6ebc1d450589ca510129b3b60 (diff) | |
download | lvm2-d28a50ec76c62c48a3be695569fe5e752b9ae684.tar.gz |
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;
Diffstat (limited to 'libdm/libdm-stats.c')
-rw-r--r-- | libdm/libdm-stats.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index 61c052fc0..c83c27bd2 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -2387,6 +2387,9 @@ bad: */ void dm_stats_destroy(struct dm_stats *dms) { + if (!dms) + return; + _stats_regions_destroy(dms); _stats_groups_destroy(dms); _stats_clear_binding(dms); |