summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2014-04-01 21:26:40 +0200
committerDavid Sommerseth <davids@redhat.com>2014-04-01 21:26:40 +0200
commitc49e4c1a9d36c28acc886793490794e86a955a04 (patch)
tree2a96e4cc51858ff10d67e996bb5899d19ae44d5c
parentcb29a4277b2aa5b5c211979c1dd3cdb098e1fcb9 (diff)
downloadpython-ethtool-c49e4c1a9d36c28acc886793490794e86a955a04.tar.gz
python-ethtool-c49e4c1a9d36c28acc886793490794e86a955a04.tar.xz
python-ethtool-c49e4c1a9d36c28acc886793490794e86a955a04.zip
Don't try to increase reference counter on non-existing hwaddress
Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r--python-ethtool/etherinfo_obj.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/python-ethtool/etherinfo_obj.c b/python-ethtool/etherinfo_obj.c
index f620157..cd7f2e3 100644
--- a/python-ethtool/etherinfo_obj.c
+++ b/python-ethtool/etherinfo_obj.c
@@ -104,7 +104,9 @@ PyObject *_ethtool_etherinfo_getter(PyEtherInfo *self, PyObject *attr_o)
}
} else if( strcmp(attr, "mac_address") == 0 ) {
get_etherinfo_link(self);
- Py_INCREF(self->hwaddress);
+ if( self->hwaddress ) {
+ Py_INCREF(self->hwaddress);
+ }
return self->hwaddress;
} else if( strcmp(attr, "ipv4_address") == 0 ) {
addrlist = get_etherinfo_address(self, NLQRY_ADDR4);