diff --git a/server/core/filter.c b/server/core/filter.c index ad7974678..87049461a 100644 --- a/server/core/filter.c +++ b/server/core/filter.c @@ -311,7 +311,7 @@ DOWNSTREAM *me; return NULL; } me->instance = filter->filter; - me->routeQuery = filter->obj->routeQuery; + me->routeQuery = (void *)(filter->obj->routeQuery); me->session = filter->obj->newSession(me->instance, session); filter->obj->setDownstream(me->instance, me->session, downstream); diff --git a/server/core/gateway.c b/server/core/gateway.c index 2bd592fe7..25c01e9b2 100644 --- a/server/core/gateway.c +++ b/server/core/gateway.c @@ -52,6 +52,7 @@ #include #include +#include #include #include #include diff --git a/server/core/gw_utils.c b/server/core/gw_utils.c index 0507e3d1c..40fca700c 100644 --- a/server/core/gw_utils.c +++ b/server/core/gw_utils.c @@ -130,6 +130,7 @@ setipaddress(struct in_addr *a, char *p) { return 1; } #endif + return 0; } /** diff --git a/server/core/service.c b/server/core/service.c index 966b9f684..aa04db972 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -650,12 +650,23 @@ FILTER_DEF **flist; char *ptr, *brkt; int n = 0; - flist = (FILTER_DEF *)malloc(sizeof(FILTER_DEF *)); + if ((flist = (FILTER_DEF **)malloc(sizeof(FILTER_DEF *))) == NULL) + { + LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR, + "Out of memory adding filters to service.\n"))); + return; + } ptr = strtok_r(filters, "|", &brkt); while (ptr) { n++; - flist = (FILTER_DEF *)realloc(flist, (n + 1) * sizeof(FILTER_DEF *)); + if ((flist = (FILTER_DEF **)realloc(flist, + (n + 1) * sizeof(FILTER_DEF *))) == NULL) + { + LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR, + "Out of memory adding filters to service.\n"))); + return; + } if ((flist[n-1] = filter_find(trim(ptr))) == NULL) { LOGIF(LE, (skygw_log_write_flush( diff --git a/server/core/session.c b/server/core/session.c index ae40b7369..f98a2903a 100644 --- a/server/core/session.c +++ b/server/core/session.c @@ -165,7 +165,7 @@ session_alloc(SERVICE *service, DCB *client_dcb) session->head.instance = service->router_instance; session->head.session = session->router_session; - session->head.routeQuery = service->router->routeQuery; + session->head.routeQuery = (void *)(service->router->routeQuery); if (service->n_filters > 0) { diff --git a/server/include/dcb.h b/server/include/dcb.h index e7d2ec716..e6beafb79 100644 --- a/server/include/dcb.h +++ b/server/include/dcb.h @@ -209,7 +209,7 @@ typedef struct dcb { struct session *session; /**< The owning session */ GWPROTOCOL func; /**< The functions for this descriptor */ - unsigned int writeqlen; /**< Current number of byes in the write queue */ + int writeqlen; /**< Current number of byes in the write queue */ SPINLOCK writeqlock; /**< Write Queue spinlock */ GWBUF *writeq; /**< Write Data Queue */ SPINLOCK delayqlock; /**< Delay Backend Write Queue spinlock */ diff --git a/server/include/service.h b/server/include/service.h index 40023332b..5b3f675b0 100644 --- a/server/include/service.h +++ b/server/include/service.h @@ -155,6 +155,7 @@ extern int serviceStop(SERVICE *); extern int serviceRestart(SERVICE *); extern int serviceSetUser(SERVICE *, char *, char *); extern int serviceGetUser(SERVICE *, char **, char **); +extern void serviceSetFilters(SERVICE *, char *); extern int serviceEnableRootUser(SERVICE *, int ); extern void service_update(SERVICE *, char *, char *, char *); extern int service_refresh_users(SERVICE *);