btrfs-progs: check: fix NULL pointer dereference for possible memory allocation failure
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Mon, 24 Oct 2016 02:43:35 +0000 (10:43 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 14 Dec 2016 14:06:34 +0000 (15:06 +0100)
commita2883ea16d15ce02c3279f835736e5072dd6e709
tree01fe98186fb1455c838a6a7d0a5004ccd5d85cd1
parent45f782abf3694d4cf2b61adeccf0c8c8974fc23f
btrfs-progs: check: fix NULL pointer dereference for possible memory allocation failure

We didn't check 'path' allocated in check_root_ref(), which can cause
NULL pointer dereference if the memory allocation failed.

Fix it by using stack memory, since the function should return error
bitmap not minus error code, we don't want memory allocation to be an
exception.

Resolves-Coverity-CID: 1372510
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c