From c49e4c1a9d36c28acc886793490794e86a955a04 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Tue, 1 Apr 2014 21:26:40 +0200 Subject: Don't try to increase reference counter on non-existing hwaddress Signed-off-by: David Sommerseth --- python-ethtool/etherinfo_obj.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'python-ethtool/etherinfo_obj.c') 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); -- cgit