Commit c4438c80 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Simplify allocation in add_xroute.

parent cde24601
......@@ -104,9 +104,7 @@ add_xroute(unsigned char prefix[16], unsigned char plen,
if(numxroutes >= maxxroutes) {
struct xroute *new_xroutes;
int n = maxxroutes < 1 ? 8 : 2 * maxxroutes;
new_xroutes = xroutes == NULL ?
malloc(n * sizeof(struct xroute)) :
realloc(xroutes, n * sizeof(struct xroute));
new_xroutes = realloc(xroutes, n * sizeof(struct xroute));
if(new_xroutes == NULL)
return -1;
maxxroutes = n;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment