File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -191,11 +191,14 @@ int get_etherinfo(struct etherinfo_obj_data *data, nlQuery query)
191191
192192 link = rtnl_link_get_by_name (link_cache , ethinf -> device );
193193 if ( !link ) {
194+ nl_cache_free (link_cache );
194195 return 0 ;
195196 }
196197
197198 ethinf -> index = rtnl_link_get_ifindex (link );
198199 if ( ethinf -> index < 0 ) {
200+ rtnl_link_put (link );
201+ nl_cache_free (link_cache );
199202 return 0 ;
200203 }
201204 rtnl_link_put (link );
@@ -220,6 +223,7 @@ int get_etherinfo(struct etherinfo_obj_data *data, nlQuery query)
220223 case NLQRY_ADDR :
221224 /* Extract IP address information */
222225 if ( rtnl_addr_alloc_cache (* data -> nlc , & addr_cache ) < 0 ) {
226+ nl_cache_free (addr_cache );
223227 return 0 ;
224228 }
225229 addr = rtnl_addr_alloc ();
@@ -229,13 +233,17 @@ int get_etherinfo(struct etherinfo_obj_data *data, nlQuery query)
229233 Py_XDECREF (ethinf -> ipv4_addresses );
230234 ethinf -> ipv4_addresses = PyList_New (0 );
231235 if (!ethinf -> ipv4_addresses ) {
236+ rtnl_addr_put (addr );
237+ nl_cache_free (addr_cache );
232238 return 0 ;
233239 }
234240
235241 /* Likewise for IPv6 addresses: */
236242 Py_XDECREF (ethinf -> ipv6_addresses );
237243 ethinf -> ipv6_addresses = PyList_New (0 );
238244 if (!ethinf -> ipv6_addresses ) {
245+ rtnl_addr_put (addr );
246+ nl_cache_free (addr_cache );
239247 return 0 ;
240248 }
241249
You can’t perform that action at this time.
0 commit comments