aboutsummaryrefslogtreecommitdiff
path: root/console-tools
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-09-13 02:46:14 +0000
committerMatt Kraai <kraai@debian.org>2000-09-13 02:46:14 +0000
commit322ae93a5e0b78b65831f9fd87fd456eb84d21a1 (patch)
tree5b967e1d873ff6eff8296bf9fda73825f0c55884 /console-tools
parentb89075298edf0a471b9046b1f3c8a936e18ead20 (diff)
downloadbusybox-w32-322ae93a5e0b78b65831f9fd87fd456eb84d21a1.tar.gz
busybox-w32-322ae93a5e0b78b65831f9fd87fd456eb84d21a1.tar.bz2
busybox-w32-322ae93a5e0b78b65831f9fd87fd456eb84d21a1.zip
Fix calls to {m,c,re}alloc so that they use x{m,c,re}alloc instead of
segfaulting or handling errors the same way themselves.
Diffstat (limited to 'console-tools')
-rw-r--r--console-tools/loadfont.c6
-rw-r--r--console-tools/loadkmap.c6
2 files changed, 2 insertions, 10 deletions
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index 927c2bad4..e93ca3186 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -102,12 +102,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
102 u_short unicode; 102 u_short unicode;
103 103
104 maxct = tailsz; /* more than enough */ 104 maxct = tailsz; /* more than enough */
105 up = (struct unipair *) malloc(maxct * sizeof(struct unipair)); 105 up = (struct unipair *) xmalloc(maxct * sizeof(struct unipair));
106 106
107 if (!up) {
108 errorMsg("Out of memory?\n");
109 exit(1);
110 }
111 for (glyph = 0; glyph < fontsize; glyph++) { 107 for (glyph = 0; glyph < fontsize; glyph++) {
112 while (tailsz >= 2) { 108 while (tailsz >= 2) {
113 unicode = (((u_short) inbuf[1]) << 8) + inbuf[0]; 109 unicode = (((u_short) inbuf[1]) << 8) + inbuf[0];
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index 488585f9c..2321a1ede 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -67,11 +67,7 @@ int loadkmap_main(int argc, char **argv)
67 exit(FALSE); 67 exit(FALSE);
68 } 68 }
69 69
70 ibuff = (u_short *) malloc(ibuffsz); 70 ibuff = (u_short *) xmalloc(ibuffsz);
71 if (!ibuff) {
72 errorMsg("Out of memory.\n");
73 exit(FALSE);
74 }
75 71
76 for (i = 0; i < MAX_NR_KEYMAPS; i++) { 72 for (i = 0; i < MAX_NR_KEYMAPS; i++) {
77 if (flags[i] == 1) { 73 if (flags[i] == 1) {