aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-21 04:32:08 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-21 04:32:08 +0000
commit838ffd5be2676e3b7317a26ec78e5643819afc70 (patch)
tree8e4bc611e627abfb53477597665f4e5296eff8fd
parent2f518b078b4d657b618589cce9a3d66edb5f31da (diff)
downloadbusybox-w32-838ffd5be2676e3b7317a26ec78e5643819afc70.tar.gz
busybox-w32-838ffd5be2676e3b7317a26ec78e5643819afc70.tar.bz2
busybox-w32-838ffd5be2676e3b7317a26ec78e5643819afc70.zip
ash: sprinkle a bit more of zeroed allocations.
-rw-r--r--shell/ash.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/shell/ash.c b/shell/ash.c
index debe8ecdd..10c0b6110 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8063,7 +8063,7 @@ mklocal(char *name)
8063 struct var *vp; 8063 struct var *vp;
8064 8064
8065 INT_OFF; 8065 INT_OFF;
8066 lvp = ckmalloc(sizeof(struct localvar)); 8066 lvp = ckzalloc(sizeof(struct localvar));
8067 if (LONE_DASH(name)) { 8067 if (LONE_DASH(name)) {
8068 char *p; 8068 char *p;
8069 p = ckmalloc(sizeof(optlist)); 8069 p = ckmalloc(sizeof(optlist));
@@ -8887,7 +8887,7 @@ pushstring(char *s, void *ap)
8887 INT_OFF; 8887 INT_OFF;
8888/*dprintf("*** calling pushstring: %s, %d\n", s, len);*/ 8888/*dprintf("*** calling pushstring: %s, %d\n", s, len);*/
8889 if (parsefile->strpush) { 8889 if (parsefile->strpush) {
8890 sp = ckmalloc(sizeof(struct strpush)); 8890 sp = ckzmalloc(sizeof(struct strpush));
8891 sp->prev = parsefile->strpush; 8891 sp->prev = parsefile->strpush;
8892 parsefile->strpush = sp; 8892 parsefile->strpush = sp;
8893 } else 8893 } else
@@ -9520,7 +9520,7 @@ raise_error_unexpected_syntax(int token)
9520 9520
9521struct heredoc { 9521struct heredoc {
9522 struct heredoc *next; /* next here document in list */ 9522 struct heredoc *next; /* next here document in list */
9523 union node *here; /* redirection node */ 9523 union node *here; /* redirection node */
9524 char *eofmark; /* string indicating end of input */ 9524 char *eofmark; /* string indicating end of input */
9525 int striptabs; /* if set, strip leading tabs */ 9525 int striptabs; /* if set, strip leading tabs */
9526}; 9526};
@@ -9564,7 +9564,7 @@ list(int nlflag)
9564 if (n1 == NULL) { 9564 if (n1 == NULL) {
9565 n1 = n2; 9565 n1 = n2;
9566 } else { 9566 } else {
9567 n3 = stalloc(sizeof(struct nbinary)); 9567 n3 = stzalloc(sizeof(struct nbinary));
9568 n3->type = NSEMI; 9568 n3->type = NSEMI;
9569 n3->nbinary.ch1 = n1; 9569 n3->nbinary.ch1 = n1;
9570 n3->nbinary.ch2 = n2; 9570 n3->nbinary.ch2 = n2;
@@ -9621,7 +9621,7 @@ andor(void)
9621 } 9621 }
9622 checkkwd = CHKNL | CHKKWD | CHKALIAS; 9622 checkkwd = CHKNL | CHKKWD | CHKALIAS;
9623 n2 = pipeline(); 9623 n2 = pipeline();
9624 n3 = stalloc(sizeof(struct nbinary)); 9624 n3 = stzalloc(sizeof(struct nbinary));
9625 n3->type = t; 9625 n3->type = t;
9626 n3->nbinary.ch1 = n1; 9626 n3->nbinary.ch1 = n1;
9627 n3->nbinary.ch2 = n2; 9627 n3->nbinary.ch2 = n2;
@@ -9648,12 +9648,12 @@ pipeline(void)
9648 pipenode = stzalloc(sizeof(struct npipe)); 9648 pipenode = stzalloc(sizeof(struct npipe));
9649 pipenode->type = NPIPE; 9649 pipenode->type = NPIPE;
9650 /*pipenode->npipe.backgnd = 0; - stzalloc did it */ 9650 /*pipenode->npipe.backgnd = 0; - stzalloc did it */
9651 lp = stalloc(sizeof(struct nodelist)); 9651 lp = stzalloc(sizeof(struct nodelist));
9652 pipenode->npipe.cmdlist = lp; 9652 pipenode->npipe.cmdlist = lp;
9653 lp->n = n1; 9653 lp->n = n1;
9654 do { 9654 do {
9655 prev = lp; 9655 prev = lp;
9656 lp = stalloc(sizeof(struct nodelist)); 9656 lp = stzalloc(sizeof(struct nodelist));
9657 checkkwd = CHKNL | CHKKWD | CHKALIAS; 9657 checkkwd = CHKNL | CHKKWD | CHKALIAS;
9658 lp->n = parse_command(); 9658 lp->n = parse_command();
9659 prev->next = lp; 9659 prev->next = lp;
@@ -9663,7 +9663,7 @@ pipeline(void)
9663 } 9663 }
9664 tokpushback = 1; 9664 tokpushback = 1;
9665 if (negate) { 9665 if (negate) {
9666 n2 = stalloc(sizeof(struct nnot)); 9666 n2 = stzalloc(sizeof(struct nnot));
9667 n2->type = NNOT; 9667 n2->type = NNOT;
9668 n2->nnot.com = n1; 9668 n2->nnot.com = n1;
9669 return n2; 9669 return n2;
@@ -9747,7 +9747,8 @@ parsefname(void)
9747 if (heredoclist == NULL) 9747 if (heredoclist == NULL)
9748 heredoclist = here; 9748 heredoclist = here;
9749 else { 9749 else {
9750 for (p = heredoclist; p->next; p = p->next); 9750 for (p = heredoclist; p->next; p = p->next)
9751 continue;
9751 p->next = here; 9752 p->next = here;
9752 } 9753 }
9753 } else if (n->type == NTOFD || n->type == NFROMFD) { 9754 } else if (n->type == NTOFD || n->type == NFROMFD) {
@@ -9828,7 +9829,7 @@ simplecmd(void)
9828 *app = NULL; 9829 *app = NULL;
9829 *vpp = NULL; 9830 *vpp = NULL;
9830 *rpp = NULL; 9831 *rpp = NULL;
9831 n = stalloc(sizeof(struct ncmd)); 9832 n = stzalloc(sizeof(struct ncmd));
9832 n->type = NCMD; 9833 n->type = NCMD;
9833 n->ncmd.args = args; 9834 n->ncmd.args = args;
9834 n->ncmd.assign = vars; 9835 n->ncmd.assign = vars;
@@ -9854,7 +9855,7 @@ parse_command(void)
9854 raise_error_unexpected_syntax(-1); 9855 raise_error_unexpected_syntax(-1);
9855 /* NOTREACHED */ 9856 /* NOTREACHED */
9856 case TIF: 9857 case TIF:
9857 n1 = stalloc(sizeof(struct nif)); 9858 n1 = stzalloc(sizeof(struct nif));
9858 n1->type = NIF; 9859 n1->type = NIF;
9859 n1->nif.test = list(0); 9860 n1->nif.test = list(0);
9860 if (readtoken() != TTHEN) 9861 if (readtoken() != TTHEN)
@@ -9862,7 +9863,7 @@ parse_command(void)
9862 n1->nif.ifpart = list(0); 9863 n1->nif.ifpart = list(0);
9863 n2 = n1; 9864 n2 = n1;
9864 while (readtoken() == TELIF) { 9865 while (readtoken() == TELIF) {
9865 n2->nif.elsepart = stalloc(sizeof(struct nif)); 9866 n2->nif.elsepart = stzalloc(sizeof(struct nif));
9866 n2 = n2->nif.elsepart; 9867 n2 = n2->nif.elsepart;
9867 n2->type = NIF; 9868 n2->type = NIF;
9868 n2->nif.test = list(0); 9869 n2->nif.test = list(0);
@@ -9881,7 +9882,7 @@ parse_command(void)
9881 case TWHILE: 9882 case TWHILE:
9882 case TUNTIL: { 9883 case TUNTIL: {
9883 int got; 9884 int got;
9884 n1 = stalloc(sizeof(struct nbinary)); 9885 n1 = stzalloc(sizeof(struct nbinary));
9885 n1->type = (lasttoken == TWHILE) ? NWHILE : NUNTIL; 9886 n1->type = (lasttoken == TWHILE) ? NWHILE : NUNTIL;
9886 n1->nbinary.ch1 = list(0); 9887 n1->nbinary.ch1 = list(0);
9887 got = readtoken(); 9888 got = readtoken();
@@ -9897,7 +9898,7 @@ parse_command(void)
9897 case TFOR: 9898 case TFOR:
9898 if (readtoken() != TWORD || quoteflag || ! goodname(wordtext)) 9899 if (readtoken() != TWORD || quoteflag || ! goodname(wordtext))
9899 raise_error_syntax("Bad for loop variable"); 9900 raise_error_syntax("Bad for loop variable");
9900 n1 = stalloc(sizeof(struct nfor)); 9901 n1 = stzalloc(sizeof(struct nfor));
9901 n1->type = NFOR; 9902 n1->type = NFOR;
9902 n1->nfor.var = wordtext; 9903 n1->nfor.var = wordtext;
9903 checkkwd = CHKKWD | CHKALIAS; 9904 checkkwd = CHKKWD | CHKALIAS;
@@ -9937,7 +9938,7 @@ parse_command(void)
9937 t = TDONE; 9938 t = TDONE;
9938 break; 9939 break;
9939 case TCASE: 9940 case TCASE:
9940 n1 = stalloc(sizeof(struct ncase)); 9941 n1 = stzalloc(sizeof(struct ncase));
9941 n1->type = NCASE; 9942 n1->type = NCASE;
9942 if (readtoken() != TWORD) 9943 if (readtoken() != TWORD)
9943 raise_error_unexpected_syntax(TWORD); 9944 raise_error_unexpected_syntax(TWORD);
@@ -9958,7 +9959,7 @@ parse_command(void)
9958 while (t != TESAC) { 9959 while (t != TESAC) {
9959 if (lasttoken == TLP) 9960 if (lasttoken == TLP)
9960 readtoken(); 9961 readtoken();
9961 *cpp = cp = stalloc(sizeof(struct nclist)); 9962 *cpp = cp = stzalloc(sizeof(struct nclist));
9962 cp->type = NCLIST; 9963 cp->type = NCLIST;
9963 app = &cp->nclist.pattern; 9964 app = &cp->nclist.pattern;
9964 for (;;) { 9965 for (;;) {
@@ -10344,13 +10345,13 @@ parseredir: {
10344 /*np->nfile.fd = 0; - stzalloc did it */ 10345 /*np->nfile.fd = 0; - stzalloc did it */
10345 } 10346 }
10346 np->type = NHERE; 10347 np->type = NHERE;
10347 heredoc = stalloc(sizeof(struct heredoc)); 10348 heredoc = stzalloc(sizeof(struct heredoc));
10348 heredoc->here = np; 10349 heredoc->here = np;
10349 c = pgetc(); 10350 c = pgetc();
10350 if (c == '-') { 10351 if (c == '-') {
10351 heredoc->striptabs = 1; 10352 heredoc->striptabs = 1;
10352 } else { 10353 } else {
10353 heredoc->striptabs = 0; 10354 /*heredoc->striptabs = 0; - stzalloc did it */
10354 pungetc(); 10355 pungetc();
10355 } 10356 }
10356 break; 10357 break;
@@ -10941,7 +10942,7 @@ parseheredoc(void)
10941 union node *n; 10942 union node *n;
10942 10943
10943 here = heredoclist; 10944 here = heredoclist;
10944 heredoclist = 0; 10945 heredoclist = NULL;
10945 10946
10946 while (here) { 10947 while (here) {
10947 if (needprompt) { 10948 if (needprompt) {