mirror of
https://review.haiku-os.org/haiku
synced 2025-02-08 22:58:18 +01:00
In hrev48870 I made some updates to DiskUsage which accidentally caused this CID. Both the volume and item pointers were going out of scope without being deleted in the error case leading to a resource leak. This commit seeks to fix the problem by creating these objects as late as possible after the error checking. tempVolume, which, as it's name implies, is created temporarily on the stack is used instead of volume up until the point that AddTab() requires a more permanent heap-stored volume pointer. Same goes for the VolumeView and VolumeTab. name is created temporarily on the stack as well which works because it is copied when passed into VolumeView constructor by the grandparent BHandler before going out of scope.