networkd: avoid NULL pointer dereference in route_add

If no result parameter is provided, do not attempt to write the
found/newly-created route to it. This is presently not an issue as all
callers currently provide a non-NULL result parameter, however we should
do this for symmetry with address_add and future code robustness.
This commit is contained in:
Michael Chapman 2016-08-16 19:07:42 +10:00
parent 5f9a610ad2
commit 856e309d7b
1 changed files with 2 additions and 1 deletions

View File

@ -322,7 +322,8 @@ int route_add(
} else
return r;
*ret = route;
if (ret)
*ret = route;
return 0;
}