[kbd] [PATCH 2/5] setvtrgb: Don't gratuitously use malloc

Felix Janda <[email protected]>
Newsgroups dev.linux.lists.kbd
Message-ID <20150422190618.GB3170@euler>
---
 src/setvtrgb.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/setvtrgb.c b/src/setvtrgb.c
index f99badc..b398615 100644
--- a/src/setvtrgb.c
+++ b/src/setvtrgb.c
@@ -11,7 +11,7 @@
 #include "nls.h"
 #include "version.h"
 
-static unsigned char *cmap;
+static unsigned char cmap[3 * 16];
 
 /* Standard VGA terminal colors, matching those hardcoded in the Linux kernel's
  * drivers/char/vt.c
@@ -71,9 +71,6 @@ parse_file(FILE *fd, const char *filename)
 	int c;
 	unsigned int rows, cols, val;
 
-	if ((cmap = calloc(3 * 16, sizeof(unsigned char))) == NULL)
-		error(EXIT_FAILURE, errno, "calloc");
-
 	for (rows = 0; rows < 3; rows++) {
 		cols = 0;
 
@@ -148,7 +145,6 @@ main(int argc, char **argv) {
 	}
 
 	set_colormap(cmap);
-	free(cmap);
 
 	return EXIT_SUCCESS;
 }
-- 
2.0.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.