Bug in mem moving in log.c

solving the bug if the complete buffer is not sent