Whamcloud - gitweb
LU-6541 utils: fix potential memory leaks with realloc() 14/14814/3
authorDmitry Eremin <dmitry.eremin@intel.com>
Thu, 14 May 2015 18:19:26 +0000 (21:19 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 19 Jul 2015 04:07:36 +0000 (04:07 +0000)
commit55f2a237320f23cb59df23518f5a72698d4f251c
treef5547bbde5294df50b10c90d9e1c1a70a59efd37
parenta001ce6f192f2bb284980d3bfcf94f9df1d15ca6
LU-6541 utils: fix potential memory leaks with realloc()

The semantics of realloc are to return NULL when the allocation fails,
but won't free the original allocation:

"The realloc() function returns a pointer to the newly allocated memory,
which is suitably aligned for any built-in type and may be different
from ptr, or NULL if the request fails. If size was equal to 0, either
NULL or a pointer suitable to be passed to free() is returned. If
realloc() fails, the original block is left untouched; it is not freed
or moved."

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ib348acad13c866a2904e023ac5822f23d13b38ca
Reviewed-on: http://review.whamcloud.com/14814
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/multiop.c
lustre/utils/gss/krb5_util.c
lustre/utils/obd.c