routerset_t has two representations of an empty routerset: NULL, and
a set containing no elements. But some of our config code assumes
that empty routersets are represented as NULL. So let's give it
what it assumes.
Fixes bug 31495. Bugfix on
e16b90b88a76; but not in any released
Tor.
*errmsg = tor_strdup("Invalid router list.");
return -1;
} else {
+ if (routerset_is_empty(rs)) {
+ /* Represent empty sets as NULL. */
+ routerset_free(rs);
+ }
*p = rs;
return 0;
}
routerset_t **output = (routerset_t**)dest;
const routerset_t *input = *(routerset_t**)src;
routerset_free(*output); // sets *output to NULL
- *output = routerset_new();
- routerset_union(*output, input);
+ if (! routerset_is_empty(input)) {
+ *output = routerset_new();
+ routerset_union(*output, input);
+ }
return 0;
}