# HG changeset patch # User Mike Becker # Date 1504177855 -7200 # Node ID 1e3e374d938660df549bfeb10b2b9d13631fede6 # Parent 0f83fe5e2b0795d69a560438a96f1bd0593d564a adds clean handling in case the stack of dav_exec_expr() runs out of memory diff -r 0f83fe5e2b07 -r 1e3e374d9386 libidav/davqlexec.c --- 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) \