network: Add missing freeaddrinfo on error path.
[collectd.git] / contrib / collectd_network.py
index 9c1e9fb..cb328f2 100644 (file)
@@ -16,7 +16,7 @@
 Collectd network protocol implementation.
 """
 
-import socket,struct,sys
+import socket,struct
 import platform
 if platform.python_version() < '2.8.0':
     # Python 2.7 and below io.StringIO does not like unicode
@@ -81,7 +81,7 @@ def decode_network_values(ptype, plen, buf):
     assert double.size == number.size
 
     result = []
-    for dstype in buf[header.size+short.size:off]:
+    for dstype in [ord(x) for x in buf[header.size+short.size:off]]:
         if dstype == DS_TYPE_COUNTER:
             result.append((dstype, number.unpack_from(buf, off)[0]))
             off += valskip