]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfsprogs: libxcmd: don't clobber fs_table on realloc()
authorAlex Elder <aelder@sgi.com>
Wed, 28 Sep 2011 10:57:08 +0000 (10:57 +0000)
committerAlex Elder <aelder@sgi.com>
Thu, 29 Sep 2011 14:30:45 +0000 (09:30 -0500)
commit8e96bcac0bf561e78b3d226a6287e84194d0802b
treeb0aad30d49c11170653e3d90f7c2c87186b026b2
parenta6a7776a86b2b58cb10c62f41d6cd2946ce01b26
xfsprogs: libxcmd: don't clobber fs_table on realloc()

In fs_table_insert(), realloc() is called to resize the global
fs_table.  If it fails, it overwrites a previously valid fs_table
pointer with NULL.

Instead, assign the return value to a local temporary and overwrite
fs_table only if the realloc() call succeeds.  The only defined
errno value for a realloc() failure is ENOMEM, so return that
explicitly in the event it fails.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxcmd/paths.c