mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Fix uninitialized memory use with -MT and -MQ
This didn't break unless the first uninitialized byte was non-zero, which happened to be the case on someone's Windows machine. Would it be worth it setting up Valgrind in CI?
This commit is contained in:
@@ -454,7 +454,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Long-only options */
|
||||
case 0:
|
||||
if (depType) {
|
||||
switch (depType) {
|
||||
case 'G':
|
||||
oGeneratedMissingIncludes = true;
|
||||
@@ -472,9 +471,16 @@ int main(int argc, char *argv[])
|
||||
ep = make_escape(ep);
|
||||
|
||||
nTargetFileNameLen += strlen(ep) + 1;
|
||||
if (!tzTargetFileName) {
|
||||
/* On first alloc, make an empty str */
|
||||
tzTargetFileName =
|
||||
malloc(nTargetFileNameLen + 1);
|
||||
*tzTargetFileName = '\0';
|
||||
} else {
|
||||
tzTargetFileName =
|
||||
realloc(tzTargetFileName,
|
||||
nTargetFileNameLen + 1);
|
||||
}
|
||||
if (tzTargetFileName == NULL)
|
||||
err(1, "Cannot append new file to target file list");
|
||||
strcat(tzTargetFileName, ep);
|
||||
@@ -486,7 +492,6 @@ int main(int argc, char *argv[])
|
||||
*ptr = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Unrecognized options */
|
||||
|
||||
Reference in New Issue
Block a user