Changeset: 369d2c0ae9da for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/369d2c0ae9da Modified Files: clients/mapiclient/mclient.c gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_batop.c monetdb5/extras/rapi/rapi.c sql/backends/monet5/sql.c Branch: default Log Message:
Merge with Jan2022 branch. diffs (76 lines): diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1046,15 +1046,15 @@ static ATOMIC_FLAG mapi_initialized = AT return (e); \ } \ } while (0) -#define REALLOC(p, c) \ - do { \ - if (p) { \ - void *tmp = (p); \ - (p) = realloc((p), (c) * sizeof(*(p))); \ - if ((p) == NULL) \ - free(tmp); \ - } else \ - (p) = malloc((c) * sizeof(*(p))); \ +#define REALLOC(p, c) \ + do { \ + if (p) { \ + void *tmp = realloc((p), (c) * sizeof(*(p))); \ + if (tmp == NULL) \ + free(p); \ + (p) = tmp; \ + } else \ + (p) = malloc((c) * sizeof(*(p))); \ } while (0) /* @@ -3443,11 +3443,11 @@ mapi_prepare(Mapi mid, const char *cmd) do { \ /* note: k==strlen(hdl->query) */ \ if (k+len >= lim) { \ - char *q = hdl->query; \ lim = k + len + MAPIBLKSIZE; \ - hdl->query = realloc(hdl->query, lim); \ - if (hdl->query == NULL) { \ - free(q); \ + char *q = realloc(hdl->query, lim); \ + if (q == NULL) { \ + free(hdl->query); \ + hdl->query = NULL; \ return; \ } \ } \ @@ -3583,11 +3583,11 @@ mapi_param_store(MapiHdl hdl) val = mapi_quote(buf, 1); /* note: k==strlen(hdl->query) */ if (k + strlen(val) + 3 >= lim) { - char *q = hdl->query; lim = k + strlen(val) + 3 + MAPIBLKSIZE; - hdl->query = realloc(hdl->query, lim); - if (hdl->query == NULL) { - free(q); + char *q = realloc(hdl->query, lim); + if (q == NULL) { + free(hdl->query); + hdl->query = NULL; free(val); return; } @@ -3599,11 +3599,11 @@ mapi_param_store(MapiHdl hdl) val = mapi_quote((char *) src, hdl->params[i].sizeptr ? *hdl->params[i].sizeptr : -1); /* note: k==strlen(hdl->query) */ if (k + strlen(val) + 3 >= lim) { - char *q = hdl->query; lim = k + strlen(val) + 3 + MAPIBLKSIZE; - hdl->query = realloc(hdl->query, lim); - if (hdl->query == NULL) { - free(q); + char *q = realloc(hdl->query, lim); + if (q == NULL) { + free(hdl->query); + hdl->query = NULL; free(val); return; } _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org