summaryrefslogtreecommitdiffabout
path: root/src/variable.c
Side-by-side diff
Diffstat (limited to 'src/variable.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/variable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/variable.c b/src/variable.c
index bd79c3b..e6bad1a 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -383,12 +383,14 @@ vmod_global_unset(VARIABLE_CTX ctx, VCL_STRING name)
static struct symtab *
get_symtab(VARIABLE_CTX ctx)
{
struct symtab *st;
int fd = ctx->req->sp->fd;
+
+ assert(fd >= 0);
AZ(pthread_mutex_lock(&symtab_mtx));
if (symtabc <= fd) {
size_t n = fd + 1;
symtabv = realloc(symtabv, n * sizeof(symtabv[0]));
while (symtabc < n)
symtabv[symtabc++] = NULL;
@@ -725,13 +727,12 @@ vmod_regset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING rxs,
size_t n;
const char *v = vars;
const char *error_ptr;
int error_offset;
int cflags = 0;
union value value;
- char *p;
int ovsize;
int *ovector;
int i;
int rc;
pcre *re;
@@ -859,13 +860,13 @@ xdecode(char *s)
d = strchr(s, '%');
if (!d)
return;
for (s = d; *s; ) {
if (*s == '%' && hex2ul(s[1]) != -1 && hex2ul(s[2]) != -1) {
- *d++ = hex2ul(s[1]) << 4 + hex2ul(s[2]);
+ *d++ = (hex2ul(s[1]) << 4) + hex2ul(s[2]);
s += 3;
} else
*d++ = *s++;
}
*d = 0;
@@ -895,13 +896,12 @@ define_param(struct symtab *vt, struct vardef *def,
VCL_VOID
vmod_queryset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING query)
{
struct symtab *vt = get_symtab(ctx);
struct vardef *head = NULL, *tail = NULL, *def;
size_t count = 0;
- size_t n;
const char *v = vars;
while (*v) {
char const *nameptr = v;
size_t n = strcspn(v, ":,");
size_t namelen = n;
@@ -960,11 +960,11 @@ vmod_queryset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING query)
if (def)
define_param(vt, def, valptr, vallen);
} else {
def = vardef_new(variable_string, paramptr, paramlen,
NULL, 0);
define_param(vt, def, valptr, vallen);
- free(def);
+ vardef_free(def);
}
}
vardef_free(head);
}

Return to:

Send suggestions and report system problems to the System administrator.