zipl: scan_upldate_bls_path: fix memory leak of @img_value

Valgrind finding:
  ==1083976== 19 bytes in 1 blocks are definitely lost in loss record 1 of 1
  ==1083976==    at 0x484417C: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-s390x-linux.so)
  ==1083976==    by 0x48F3C97: __vasprintf_internal (vasprintf.c:71)
  ==1083976==    by 0x1006861: vasprintf (stdio2.h:218)
  ==1083976==    by 0x1006861: misc_asprintf (misc.c:49)
  ==1083976==    by 0x100C7E1: scan_update_bls_path (scan.c:1874)
  ==1083976==    by 0x100FF4B: get_job_from_config_file (job.c:1901)
  ==1083976==    by 0x100FF4B: job_get (job.c:1997)
  ==1083976==    by 0x1006335: main (zipl.c:141)

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2023-03-13 19:29:03 +01:00
committed by Steffen Eiden
parent 0a512bf904
commit 21dbbcfa56

View File

@@ -1873,8 +1873,10 @@ void scan_update_bls_path(struct scan_token *scan)
if (misc_check_readable_file(file)) {
misc_asprintf(&img_value, "%s%s",
target_value, file);
if (misc_check_readable_file(img_value))
if (misc_check_readable_file(img_value)) {
free(img_value);
continue;
}
/*
* when file has stripped the load address part,