Yesterday I updated my Macbook Air (early 2015) to macOS Mojave.
Since then when I open a terminal window I am getting recurring messages. I can't run any terminal command at the moment.
What can cause this message?
Your system is running something called the Malloc Debugging and reporting a problem in your memory ? It is a program to detect memory bugs. Since it is stuck in a endless loop, the reported memory bug might not even exist.
It reports the same bug in your memory, over and over as seen here.
More info about Debugging memory-related bugs
To stop the program in Terminal try Use key combination in Terminal Ctrl + C. or, Ctrl + Z , or CTRL+ \
You can also try...
Simple test is to start in Safe mode, or even more simple is to create new user account and try it.