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

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

 




>----Original Message----
>From: kaartic.sivaraam@xxxxxxxxx
>Date: 20/12/2017 18:33 
>To: "Phillip Wood"<phillip.wood@xxxxxxxxxxxxx>, "Git Mailing List"
<git@xxxxxxxxxxxxxxx>
>Cc: "Johannes Schindelin"<Johannes.Schindelin@xxxxxx>
>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;
        }






[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]

  Powered by Linux