shithub: rgbds

Download patch

ref: de76dcb8fb2716f73e7e375c38119333fa9d24a0
parent: 30fb6bde5e89504162a8471e674d9a2bdac1e9ad
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun Nov 29 07:33:46 EST 2020

Fix possible segfault from -MT and -MQ

Happened only if `malloc` failed, so...

--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -432,7 +432,8 @@
 					/* On first alloc, make an empty str */
 					tzTargetFileName =
 						malloc(nTargetFileNameLen + 1);
-					*tzTargetFileName = '\0';
+					if (tzTargetFileName)
+						*tzTargetFileName = '\0';
 				} else {
 					tzTargetFileName =
 						realloc(tzTargetFileName,