hstr: malloc: attempt to free non-allocated memory (uninitialized/freed pointer/NULL)

Whenever I use hstr I get the following errors:

$ hstr
ls
hstr(45522,0x1142ce5c0) malloc: *** error for object 0x7fccffe4f40f: pointer being freed was not allocated
hstr(45522,0x1142ce5c0) malloc: *** set a breakpoint in malloc_error_break to debug
[1]    45522 abort      hstr
$ ls

It doesn’t matter if I trigger it with hstr, hh or ^R, I always get the malloc errors. hstr still works, but always prints the errors I recently re-installed my machine from scratch but the problem persists.

My config:

  • macOS Mojave v10.14.5
  • zsh 5.7.1 (x86_64-apple-darwin18.2.0)
alias hh=hstr                                # hh to be alias for hstr
export HISTFILE=~/.zhistory                  # ensure history file visibility
export HISTFILESIZE=100000                   # increase history file size
export HISTSIZE=${HISTFILESIZE}
export HSTR_CONFIG=hicolor,raw-history-view,blacklist
bindkey -s "\C-r" "\eqhstr\n"                # bind hh to Ctrl-r

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

😞 thank you@jonand. I will set up macOS installation when I will be releasing my other project and try to debug it there. Thanks for patience & help!

This is the commit that introduced this error https://github.com/dvorka/hstr/commit/c36754179965d09b83d72f0bd575a08919208bf5 Any C developers that can spot what’s wrong with it?

❯ lldb ./src/hstr
(lldb) target create "./src/hstr"
Current executable set to '/Users/gabriel.ostrolucky/Documents/hstr/src/hstr' (x86_64).
(lldb) b malloc_error_break
Breakpoint 1: where = libsystem_malloc.dylib`malloc_error_break, address = 0x0000000000019355
(lldb) run
Process 93532 launched: '/Users/gabriel.ostrolucky/Documents/hstr/src/hstr' (x86_64)
hstr(93532,0x1000d8dc0) malloc: *** error for object 0x102a0be2f: pointer being freed was not allocated
hstr(93532,0x1000d8dc0) malloc: *** set a breakpoint in malloc_error_break to debug
Process 93532 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00007fff68953355 libsystem_malloc.dylib`malloc_error_break
libsystem_malloc.dylib`malloc_error_break:
->  0x7fff68953355 <+0>: pushq  %rbp
    0x7fff68953356 <+1>: movq   %rsp, %rbp
    0x7fff68953359 <+4>: nop
    0x7fff6895335a <+5>: nopl   (%rax)
Target 0: (hstr) stopped.
(lldb)