Static analysis: add dtor in bridging curl-client 53/24753/2
authorMats Wichmann <mats@linux.com>
Wed, 18 Apr 2018 21:48:11 +0000 (15:48 -0600)
committerMats Wichmann <mats@linux.com>
Sat, 21 Apr 2018 15:10:26 +0000 (15:10 +0000)
Coverity analysis points out _MemoryChunk struct has a ctor which
malloc's memory, but no dtor to free it.  It's one byte, not going
to lead to memory exhaustion (!) but let's keep to good practices.

Change-Id: I3dccb8b6355b6cdee0110653074f748abf9a2c16
Signed-off-by: Mats Wichmann <mats@linux.com>
bridging/include/curlClient.h

index 934a470..5eac673 100644 (file)
@@ -157,6 +157,11 @@ namespace OC
                         memory = static_cast<char *>(malloc(1));
                     }
 
+                    ~_MemoryChunk()
+                    {
+                        free(memory);
+                    }
+
                     char *memory;
                     size_t size;