peltool: Fixing memory leak in peltool

On analysis of a defect which points BMC reboot issue, it is found that
peltool has a memory leak which increases the memory consumption on
runtime.

Done the analysis for the same by generating valgrind report for peltool
and figured out that a block of memory which is getting allocated
dynamically in the API dumpHex() is not getting freed properly, results
in memory leak.

Fixing the same by changing the pointer which points to the block of
memory to a unique_ptr.

Tested:
The new valgrind report generated for peltool after adding the changes
shows zero leakage.
```
==883== LEAK SUMMARY:
==883==    definitely lost: 0 bytes in 0 blocks
==883==    indirectly lost: 0 bytes in 0 blocks
==883==      possibly lost: 0 bytes in 0 blocks
==883==    still reachable: 9,786 bytes in 31 blocks
==883==         suppressed: 0 bytes in 0 blocks
```

Signed-off-by: Arya K Padman <aryakpadman@gmail.com>
Change-Id: I55db4feedff3a139d0f44a5ace1778acc7375596
diff --git a/extensions/openpower-pels/json_utils.hpp b/extensions/openpower-pels/json_utils.hpp
index c972459..bf90d9b 100644
--- a/extensions/openpower-pels/json_utils.hpp
+++ b/extensions/openpower-pels/json_utils.hpp
@@ -8,6 +8,7 @@
 #include <fstream>
 #include <iomanip>
 #include <iostream>
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -31,10 +32,10 @@
  * @param[in] size_t indentCount - The number of indent levels to indent
  * @param[in] bool toJson - if true, output lines as JSON array, else print
  *            output as plain text
- * @return char * - the Hex dump
+ * @return std::unique_ptr<char[]> - the Hex dump
  */
-char* dumpHex(const void* data, size_t size, size_t indentCount,
-              bool toJson = true);
+std::unique_ptr<char[]> dumpHex(const void* data, size_t size,
+                                size_t indentCount, bool toJson = true);
 
 /**
  * @brief Inserts key-value into a JSON string