Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) I tried to create a patch file of a commit in another directory using the following command: [josi@localhost typescript]$ git format-patch -1 236a9 --output=/home/josi/tmp/patches/txt-6117.patch What did you expect to happen? (Expected behavior) I expected a patch file at the location specified in --output What happened instead? (Actual behavior) git crashed: 0001-Txture-Core-Implemented-whitelisting-for-groovy-scri.patch free(): invalid pointer Aborted (core dumped) What's different between what you expected and what actually happened? I didn't expect the crash :D Anything else you want to add: I do have a full core dump recorded by ABRT (Fedora). Please let me know at johannes.postler@txture.io if you need thaThe following is the backtrace according to ABRT: { "signal": 6 , "executable": "/usr/bin/git" , "stacktrace": [ { "crash_thread": true , "frames": [ { "address": 139721002875845 , "build_id": "2602cd2de6dc672a5ec4378ace0b4a68ea5b13ea" , "build_id_offset": 252869 , "function_name": "raise" , "file_name": "/lib64/libc.so.6" } , { "address": 139721002780836 , "build_id": "2602cd2de6dc672a5ec4378ace0b4a68ea5b13ea" , "build_id_offset": 157860 , "function_name": "abort" , "file_name": "/lib64/libc.so.6" } , { "address": 139721003147559 , "build_id": "2602cd2de6dc672a5ec4378ace0b4a68ea5b13ea" , "build_id_offset": 524583 , "function_name": "__libc_message" , "file_name": "/lib64/libc.so.6" } , { "address": 139721003179548 , "build_id": "2602cd2de6dc672a5ec4378ace0b4a68ea5b13ea" , "build_id_offset": 556572 , "function_name": ".annobin_top_check.start" , "file_name": "/lib64/libc.so.6" } , { "address": 139721003186412 , "build_id": "2602cd2de6dc672a5ec4378ace0b4a68ea5b13ea" , "build_id_offset": 563436 , "function_name": "_int_free" , "file_name": "/lib64/libc.so.6" } , { "address": 139721003104931 , "build_id": "2602cd2de6dc672a5ec4378ace0b4a68ea5b13ea" , "build_id_offset": 481955 , "function_name": "fclose@@GLIBC_2.2.5" , "file_name": "/lib64/libc.so.6" } , { "address": 94420595460270 , "build_id": "ba2b8ad417de884d751cd7503b17e9ce357b2dcf" , "build_id_offset": 538798 , "function_name": "cmd_format_patch" , "file_name": "/usr/bin/git" } , { "address": 94420595060875 , "build_id": "ba2b8ad417de884d751cd7503b17e9ce357b2dcf" , "build_id_offset": 139403 , "function_name": "handle_builtin.lto_priv.0" , "file_name": "/usr/bin/git" } , { "address": 94420595041051 , "build_id": "ba2b8ad417de884d751cd7503b17e9ce357b2dcf" , "build_id_offset": 119579 , "function_name": "main" , "file_name": "/usr/bin/git" } ] } ] } Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.28.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.8.16-300.fc33.x86_64 #1 SMP Mon Oct 19 13:18:33 UTC 2020 x86_64 compiler info: gnuc: 10.2 libc info: glibc: 2.32 $SHELL (typically, interactive shell): /bin/bash [Enabled Hooks] applypatch-msg pre-applypatch post-applypatch pre-commit pre-merge-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-push pre-receive update post-receive post-update push-to-checkout pre-auto-gc post-rewrite sendemail-validate