summaryrefslogtreecommitdiffstats
path: root/python-ethtool/etherinfo.c
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2014-01-10 17:57:05 +0100
committerDavid Sommerseth <davids@redhat.com>2014-01-10 17:57:05 +0100
commitb15cd540acf49a283d30c28e1424230e51440772 (patch)
tree06db6e36d61ac4800acfb2a1e99a99f665514393 /python-ethtool/etherinfo.c
parente52b6636a9c9850cf6e908e647a600a144d21da4 (diff)
downloadpython-ethtool-b15cd540acf49a283d30c28e1424230e51440772.tar.gz
python-ethtool-b15cd540acf49a283d30c28e1424230e51440772.tar.xz
python-ethtool-b15cd540acf49a283d30c28e1424230e51440772.zip
Added some extra error checks with libnl calls
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'python-ethtool/etherinfo.c')
-rw-r--r--python-ethtool/etherinfo.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/python-ethtool/etherinfo.c b/python-ethtool/etherinfo.c
index bac0fe7..c5e6798 100644
--- a/python-ethtool/etherinfo.c
+++ b/python-ethtool/etherinfo.c
@@ -185,7 +185,9 @@ int get_etherinfo_link(PyEtherInfo *self)
return 0;
}
link = rtnl_link_alloc();
- /* FIXME: Error handling? */
+ if( !link ) {
+ return 0;
+ }
rtnl_link_set_ifindex(link, self->index);
nl_cache_foreach_filter(link_cache, OBJ_CAST(link), callback_nl_link, self);
rtnl_link_put(link);
@@ -236,7 +238,9 @@ PyObject * get_etherinfo_address(PyEtherInfo *self, nlQuery query)
return NULL;
}
addr = rtnl_addr_alloc();
- /* FIXME: Error handling? */
+ if( !addr ) {
+ return NULL;
+ }
rtnl_addr_set_ifindex(addr, self->index);
switch( query ) {