dispatch_new: fix leak of ret
@@ -665,8 +665,10 @@ dispatch_new(char id, enum conntype type, router *r, char *allowed_chars)
if (ret == NULL)
return NULL;
- if (type == CONNECTION && r == NULL)
+ if (type == CONNECTION && r == NULL) {
+ free(ret);
return NULL;
+ }
ret->id = id;
ret->type = type;
