Fix memory management in gp_sparse_vector
palloc() is guaranteed to only return on successful allocation, so there
is no need to check it. ereport(ERROR..) is guaranteed never to return,
and to clean up on it's way out, so pfree()ing after an ereport() is not
just unreachable code, it would be a double-free if it was reached.
Also add proper checks on the malloc() and strdup() calls as those are
subject to the usual memory pressure controls by the programmer.
Reviewed-by: NHeikki Linnakangas <hlinnakangas@pivotal.io>
Showing
想要评论请 注册 或 登录