File s390-tools-sles15sp3-02-genprotimg-fix-two-memory-leaks.patch of Package s390-tools.23193

Subject: [PATCH] [FEAT VS2010] genprotimg: fix two memory leaks
From: Marc Hartmayer <mhartmay@linux.ibm.com>

Summary:     genprotimg: add host-key document verification
Description: Add host-key document verification support to genprotimg. This
             ensures that a host-key document is genuine and provided by
             IBM. For this the user must provide the IBM Z signing key, the
             intermediate CA certificate (signed by the root CA used) so a
             chain of trust starting from the host-key document and ending in
             the root CA can be established.
Upstream-ID: db6f272607842a6279fee589fb101f3a1f6148f3
Problem-ID:  VS2010

Upstream-Description:

             genprotimg: fix two memory leaks

             ==1005844== HEAP SUMMARY:
             ==1005844==     in use at exit: 18,907 bytes in 14 blocks
             ==1005844==   total heap usage: 82 allocs, 68 frees, 32,529 bytes allocated
             ==1005844==
             ==1005844== 136 (104 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 12 of 14
             ==1005844==    at 0x483885A: calloc (vg_replace_malloc.c:760)
             ==1005844==    by 0x48C950D: g_malloc0 (gmem.c:132)
             ==1005844==    by 0x100EC41: pv_args_new (pv_args.c:364)
             ==1005844==    by 0x100587F: main (genprotimg.c:122)
             ==1005844==
             ==1005844== LEAK SUMMARY:
             ==1005844==    definitely lost: 104 bytes in 1 blocks
             ==1005844==    indirectly lost: 32 bytes in 1 blocks
             ==1005844==      possibly lost: 0 bytes in 0 blocks
             ==1005844==    still reachable: 18,771 bytes in 12 blocks
             ==1005844==         suppressed: 0 bytes in 0 blocks
             ==1005844== Reachable blocks (those to which a pointer was found) are not shown.
             ==1005844== To see them, rerun with: --leak-check=full --show-leak-kinds=all
             ==1005844==
             ==1005844== For lists of detected and suppressed errors, rerun with: -s
             ==1005844== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

             Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
             Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>


Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Index: s390-tools-service/genprotimg/src/genprotimg.c
===================================================================
--- s390-tools-service.orig/genprotimg/src/genprotimg.c
+++ s390-tools-service/genprotimg/src/genprotimg.c
@@ -177,5 +177,7 @@ error:
 	rmdir_recursive(tmp_dir, NULL);
 	remove_signal_handler(signals, G_N_ELEMENTS(signals));
 	g_free(tmp_dir);
+	g_clear_pointer(&img, pv_img_free);
+	g_clear_pointer(&args, pv_args_free);
 	exit(ret);
 }
openSUSE Build Service is sponsored by