From 9684acfec0eb3b6286deb2ced7e365c705b74d9a Mon Sep 17 00:00:00 2001 From: AbelPau Date: Mon, 24 Feb 2025 10:13:05 +0100 Subject: [PATCH] MiraMonVector fix error: Unexpected Non-nullptr Return A nullptr is expected when the section is not present in an INI file. However, in a particular case, the function MMReturnValueFromSectionINIFile returned a value other than nullptr. Although this did not cause an immediate error, it resulted in incorrect information being presented to the user. --- ogr/ogrsf_frmts/miramon/mm_wrlayr.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ogr/ogrsf_frmts/miramon/mm_wrlayr.c b/ogr/ogrsf_frmts/miramon/mm_wrlayr.c index e3f7aef0c8eb..bb034a841f43 100644 --- a/ogr/ogrsf_frmts/miramon/mm_wrlayr.c +++ b/ogr/ogrsf_frmts/miramon/mm_wrlayr.c @@ -5315,7 +5315,16 @@ char *MMReturnValueFromSectionINIFile(const char *filename, const char *section, } else { - value = section_header; // Freed out + if (section_header) + { + if (!strcmp(section_header, section)) + value = section_header; // Freed out + else + value = nullptr; + } + else + value = nullptr; + fclose_function(file); free_function(pszString); return value; @@ -6079,6 +6088,7 @@ int MMCheck_REL_FILE(const char *szREL_file) MMCPLError(CE_Failure, CPLE_OpenFailed, "The file \"%s\" must be REL4. " "You can use ConvREL.exe from MiraMon software " + " or GeM+ " "to convert this file to REL4.", szREL_file); return 1;