[PATCH 1/2] Btrfs-progs: make pretty_sizes() works less error prone

2013-07-03 Thread Wang Shilong
From: Wang Shilong wangsl-f...@cn.fujitsu.com In the original code, pretty_sizes() may return NULL in two cases: 1 Allocating memory dynamically fails 2 Overflow happens(size exceeds YB) The original codes don't handle error gracefully and some places forget to free memory. However, just

Re: [PATCH 1/2] Btrfs-progs: make pretty_sizes() works less error prone

2013-07-03 Thread David Sterba
On Thu, Jul 04, 2013 at 12:07:37AM +0800, Wang Shilong wrote: From: Wang Shilong wangsl-f...@cn.fujitsu.com In the original code, pretty_sizes() may return NULL in two cases: 1 Allocating memory dynamically fails Turning it into static allocation looks much better than calling malloc for ~30