author | Brandon Casey <casey@nrlssc.navy.mil> | |
Thu, 9 Oct 2008 00:07:54 +0000 (19:07 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 9 Oct 2008 15:13:29 +0000 (08:13 -0700) | ||
commit | 36e40535dcafe230a7f5ef43fea5cf67c1c58f6f | |
tree | 16778e960ebdeff1b627b5ae5d2221d94b955951 | tree | snapshot |
parent | fb7424363643d6049faf3bda399e5e602782b5b7 | commit | diff |
builtin-merge.c: allocate correct amount of memory
Fix two memory allocation errors which allocate space for a pointer
rather than enough space for the structure itself.
This:
struct commit_list *parent = xmalloc(sizeof(struct commit_list *));
should have been this:
struct commit_list *parent = xmalloc(sizeof(struct commit_list));
But while we're at it, change the allocation to reference the
variable it is allocating memory for to try to prevent a similar
mistake, for example if the type is changed, in the future.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Fix two memory allocation errors which allocate space for a pointer
rather than enough space for the structure itself.
This:
struct commit_list *parent = xmalloc(sizeof(struct commit_list *));
should have been this:
struct commit_list *parent = xmalloc(sizeof(struct commit_list));
But while we're at it, change the allocation to reference the
variable it is allocating memory for to try to prevent a similar
mistake, for example if the type is changed, in the future.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
builtin-merge.c | diff | blob | history |