Re: [PATCH v2 2/4] help.c::exclude_cmds: realloc() before copy, plug a leak

2012-07-25 Thread Junio C Hamano
Tay Ray Chuan writes: > Copying with structural assignment may not take into account that the > LHS struct has sufficient memory, especially since the cmdname->name > member is nonfixed in size. Be unambiguous about it by realloc()'ing it > to be of sufficient size. If the original code were

[PATCH v2 2/4] help.c::exclude_cmds: realloc() before copy, plug a leak

2012-07-25 Thread Tay Ray Chuan
Copying with structural assignment may not take into account that the LHS struct has sufficient memory, especially since the cmdname->name member is nonfixed in size. Be unambiguous about it by realloc()'ing it to be of sufficient size. Additionally, free the unused cmdnames, which are no longer a