Skip to content

Commit c49e4c1

Browse files
author
David Sommerseth
committed
Don't try to increase reference counter on non-existing hwaddress
Signed-off-by: David Sommerseth <davids@redhat.com>
1 parent cb29a42 commit c49e4c1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python-ethtool/etherinfo_obj.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ PyObject *_ethtool_etherinfo_getter(PyEtherInfo *self, PyObject *attr_o)
104104
}
105105
} else if( strcmp(attr, "mac_address") == 0 ) {
106106
get_etherinfo_link(self);
107-
Py_INCREF(self->hwaddress);
107+
if( self->hwaddress ) {
108+
Py_INCREF(self->hwaddress);
109+
}
108110
return self->hwaddress;
109111
} else if( strcmp(attr, "ipv4_address") == 0 ) {
110112
addrlist = get_etherinfo_address(self, NLQRY_ADDR4);

0 commit comments

Comments
 (0)