Thread (11 messages) flat view 11 messages, 4 authors, 2017-12-25

Re: Error in `git': free(): invalid pointer (was Re: [PATCH] sequencer: improve config handling)

From: phillip.wood@talktalk.net <hidden>
Date: 2017-12-21 16:53:56
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

----Original Message----
From: kaartic.sivaraam@gmail.com
Date: 20/12/2017 18:33 
To: "Phillip Wood"<redacted>, "Git Mailing List"
[off-list ref]
Cc: "Johannes Schindelin"<redacted>
Subj: Error in `git&#39;: free(): invalid pointer (was Re: [PATCH] 
sequencer: improve config handling)
I recently encountered that error when trying to do an interactive
rebase after using filter-branch to remove a file completely in a
repository. I bisected this issue which pointed at this patch. I'm not
sure how it is related as I'm not too familiar with the sequencer 
code.
I could help in case any specific information is needed. As a first
step, I've posted the output of "strace /mnt/Source//Git/git rebase -i
HEAD~10" below.

Hm, There is a problem with sequencer_remove_state() which does 

free(opts->gpg_sign)

however unless a gpg key was given on the commandline, opts->gpg is 
initialized to "" which is statically allocated. 

This untested diff should fix that, but I'm not sure if you're problem 
is related to it (I'm visiting relatives so don't have much time for 
working at the moment. also I'm on webmail so apologies if the patch is 
mangled)

Best Wishes

Phillip
-- 8< --
diff --git a/sequencer.c b/sequencer.c
index 3bc487573..115ceba91 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -160,7 +160,7 @@ static int git_sequencer_config(const char *k, 
const char *v, void *cb)
        }
 
        if (!strcmp(k, "commit.gpgsign")) {
-               opts->gpg_sign = git_config_bool(k, v) ? "" : NULL;
+               opts->gpg_sign = git_config_bool(k, v) ? strdup("") : 
NULL;
                return 0;
        }


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help