From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DNS_FROM_AHBL_RHSBL, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Date: Wed, 22 Apr 2015 21:06:18 +0200 From: Felix Janda To: kbd@lists.altlinux.org Message-ID: <20150422190618.GB3170@euler> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Mailman-Approved-At: Thu, 23 Apr 2015 13:19:25 +0300 Subject: [kbd] [PATCH 2/5] setvtrgb: Don't gratuitously use malloc X-BeenThere: kbd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Linux console tools development discussion List-Id: Linux console tools development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2015 19:06:23 -0000 Archived-At: List-Archive: --- 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