Thu, 31 Aug 2017 13:10:55 +0200
adds clean handling in case the stack of dav_exec_expr() runs out of memory
libidav/davqlexec.c | file | annotate | diff | comparison | revisions |
--- a/libidav/davqlexec.c Thu Aug 31 12:58:06 2017 +0200 +++ b/libidav/davqlexec.c Thu Aug 31 13:10:55 2017 +0200 @@ -949,7 +949,14 @@ #define DAVQL_PUSH(obj) \ if(stpos == stsize) { \ stsize += 64; \ - stack = realloc(stack, stsize * sizeof(DavQLStackObj)); \ + DavQLStackObj *stack_newptr; \ + stack_newptr = realloc(stack, stsize * sizeof(DavQLStackObj)); \ + if(stack_newptr) { \ + stack = stack_newptr; \ + } else { \ + free(stack); \ + return -1; \ + }\ } \ stack[stpos++] = obj; #define DAVQL_PUSH_INT(intval) \