Skip to content

Commit

Permalink
Fix another issue in FMUParser (gcc doesn't complain in this case, bu…
Browse files Browse the repository at this point in the history
…t it should)
  • Loading branch information
jmarrec committed Nov 24, 2020
1 parent 2fc152f commit 61ce567
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions third_party/FMUParser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ int callparser(const char *fmuFilNam, const char *tmpPat)
char *filNam, *tmp, *ext;

// Get the model description
xmlPat = (char *)calloc(strlen(fmuFilNam) + strlen(XML_FILE) - 1, sizeof(char));
xmlPat = (char *)calloc(strlen(fmuFilNam) + strlen(XML_FILE) + strlen(PATH_SEP) + 1, sizeof(char));
printfDebug("fmuFilNam is \"%s\"\n", fmuFilNam);
printfDebug("Start to parse model description file\n", xmlPat);
sprintf(xmlPat, "%s%s%s", tmpPat, PATH_SEP, XML_FILE);
printfDebug("Start to parse model description file: \"%s\".\n", xmlPat);

fmu.modelDescription = parse(xmlPat);
printfDebug("Parsed model description file: \"%s\"\n", xmlPat);
Expand All @@ -59,6 +59,8 @@ int callparser(const char *fmuFilNam, const char *tmpPat)
return -1;
}

free(xmlPat);

length = strlen(fmuFilNam);
tmp = (char *)malloc((length+1) * sizeof(char));
strcpy(tmp, fmuFilNam);
Expand Down Expand Up @@ -88,10 +90,10 @@ int callparser(const char *fmuFilNam, const char *tmpPat)
printfDebug("***** Model description is \"%s\".\n", getModelIdentifier(fmu.modelDescription));

// Clean up memory
// free(xmlPat);
// free(tmp);
// free(filNam);
// free(ext);
// free(xmlPat); // Done above
free(tmp);
free(filNam);
free(ext);
return 0;
}

Expand Down

5 comments on commit 61ce567

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8312_build_warnings_v2 (jmarrec) - x86_64-MacOS-10.15-clang-11.0.0: Tests Failed (717 of 2941 tests passed, 0 test warnings)

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 717

regression Test Summary

  • Passed: 715
  • Failed: 2

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8312_build_warnings_v2 (jmarrec) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1558 of 1558 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8312_build_warnings_v2 (jmarrec) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3034 of 3034 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8312_build_warnings_v2 (jmarrec) - Win64-Windows-10-VisualStudio-16: OK (2250 of 2250 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8312_build_warnings_v2 (jmarrec) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (722 of 722 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.