[BUG] realloc failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following command causes "fatal: Out of memory, realloc failed" error.

$ ./git --version
git version 1.7.5.GIT

$ cat ~/.gitconfig
[alias]
    a = -c n=v status

$ MALLOC_CHECK_=0 ./git a
fatal: Out of memory, realloc failed

$ gdb --args ./git a
(gdb) run
*** glibc detected *** /tmp/git/git: realloc(): invalid pointer: 0x00000000007cd328 ***
...snip...
(gdb) bt
#0  0x00007ffff72c8a75 in raise () from /lib/libc.so.6
#1  0x00007ffff72cc5c0 in abort () from /lib/libc.so.6
#2  0x00007ffff73024fb in ?? () from /lib/libc.so.6
#3  0x00007ffff730c5b6 in ?? () from /lib/libc.so.6
#4  0x00007ffff73132e2 in realloc () from /lib/libc.so.6
#5  0x0000000000510bfb in xrealloc (ptr=0x7cd328, size=16) at wrapper.c:82
#6  0x0000000000405013 in handle_alias (argcp=0x7fffffffdfdc, argv=0x7fffffffdfd0) at git.c:236
#7  0x000000000040550a in run_argv (argcp=0x7fffffffdfdc, argv=0x7fffffffdfd0) at git.c:515
#8  0x000000000040566a in main (argc=1, argv=0x7fffffffe0f0) at git.c:579


When the "-c" option is specified, setenv will be called in git_config_push_parameter.
So it seems "envchanged" flag must be set to true in this case.

 git.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/git.c b/git.c
index a5ef3c6..e04e4d4 100644
--- a/git.c
+++ b/git.c
@@ -153,6 +153,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 				usage(git_usage_string);
 			}
 			git_config_push_parameter((*argv)[1]);
+			if (envchanged)
+				*envchanged = 1;
 			(*argv)++;
 			(*argc)--;
 		} else {

After applying this patch, it works.

$ ./git a
fatal: alias 'a' changes environment variables
You can use '!git' in the alias to do this.

$ vi ~/.gitconfig
[alias]
    a = !git -c n=v status
        ~~~~

$ ./git a
# On branch master
nothing to commit (working directory clean)

-- 
Kazuki Tsujimoto

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]