shithub: rgbds

Download patch

ref: 685ea5feedcd79c070883f3662f521cbfbeddc5d
parent: f5ac2689895f48509211ed99fcdcf2f069d2d7de
author: ISSOtm <[email protected]>
date: Sun Jun 12 12:39:55 EDT 2022

Fix RGBLINK leaking partial string at EOF

Does not really do much, but silences some static analyzers

--- a/src/link/object.c
+++ b/src/link/object.c
@@ -151,8 +151,10 @@
 		/* Read char */
 		int byte = getc(file);
 
-		if (byte == EOF)
+		if (byte == EOF) {
+			free(str);
 			return NULL;
+		}
 		str[index] = byte;
 	} while (str[index]);
 	return str;