Mercurial > vim
comparison src/memline.c @ 6989:c0a23e04c929 v7.4.812
patch 7.4.812
Problem: Gcc sanitizer complains about using a NULL pointer to memmove().
Solution: Only call memmove when there is something to move. (Vittorio
Zecca)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 08 Aug 2015 18:23:46 +0200 |
parents | 62ba356c2d4e |
children | 1886f2863437 |
comparison
equal
deleted
inserted
replaced
6988:e86ada5d3fa0 | 6989:c0a23e04c929 |
---|---|
3832 | 3832 |
3833 newstack = (infoptr_T *)alloc((unsigned)sizeof(infoptr_T) * | 3833 newstack = (infoptr_T *)alloc((unsigned)sizeof(infoptr_T) * |
3834 (buf->b_ml.ml_stack_size + STACK_INCR)); | 3834 (buf->b_ml.ml_stack_size + STACK_INCR)); |
3835 if (newstack == NULL) | 3835 if (newstack == NULL) |
3836 return -1; | 3836 return -1; |
3837 mch_memmove(newstack, buf->b_ml.ml_stack, | 3837 if (top > 0) |
3838 mch_memmove(newstack, buf->b_ml.ml_stack, | |
3838 (size_t)top * sizeof(infoptr_T)); | 3839 (size_t)top * sizeof(infoptr_T)); |
3839 vim_free(buf->b_ml.ml_stack); | 3840 vim_free(buf->b_ml.ml_stack); |
3840 buf->b_ml.ml_stack = newstack; | 3841 buf->b_ml.ml_stack = newstack; |
3841 buf->b_ml.ml_stack_size += STACK_INCR; | 3842 buf->b_ml.ml_stack_size += STACK_INCR; |
3842 } | 3843 } |