summaryrefslogtreecommitdiff
path: root/src/bin/embryo
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-24 13:46:30 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-24 13:46:30 +0900
commit132c047c4d8b84cc879568ee3f2f8acfd403bd58 (patch)
treebb7d35c311efc4503c2dbe3b664fbdd7b5174865 /src/bin/embryo
parent878644970481e0ca14065f0391a87df2ef3d80f8 (diff)
embryo_cc - be sensible about realloc returns so analysers are happy
assingto tmp var then assign to real one after a check to analysers dont complain.
Diffstat (limited to 'src/bin/embryo')
-rw-r--r--src/bin/embryo/embryo_cc_sc1.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c
index 2cacbe5bf9..41ccacdf34 100644
--- a/src/bin/embryo/embryo_cc_sc1.c
+++ b/src/bin/embryo/embryo_cc_sc1.c
@@ -2511,12 +2511,13 @@ declargs(symbol * sym)
2511 * have a default value */ 2511 * have a default value */
2512 if ((sym->usage & uPROTOTYPED) == 0) 2512 if ((sym->usage & uPROTOTYPED) == 0)
2513 { 2513 {
2514 arginfo *tmp;
2514 /* redimension the argument list, add the entry */ 2515 /* redimension the argument list, add the entry */
2515 sym->dim.arglist = 2516 tmp = realloc(sym->dim.arglist,
2516 (arginfo *) realloc(sym->dim.arglist, 2517 (argcnt + 2) * sizeof(arginfo));
2517 (argcnt + 2) * sizeof(arginfo)); 2518 if (!tmp)
2518 if (!sym->dim.arglist)
2519 error(103); /* insufficient memory */ 2519 error(103); /* insufficient memory */
2520 sym->dim.arglist = tmp;
2520 sym->dim.arglist[argcnt] = arg; 2521 sym->dim.arglist[argcnt] = arg;
2521 sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list 2522 sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list
2522 * terminated */ 2523 * terminated */
@@ -2548,12 +2549,13 @@ declargs(symbol * sym)
2548 tags[numtags++] = 0; /* default tag */ 2549 tags[numtags++] = 0; /* default tag */
2549 if ((sym->usage & uPROTOTYPED) == 0) 2550 if ((sym->usage & uPROTOTYPED) == 0)
2550 { 2551 {
2552 arginfo *tmp;
2551 /* redimension the argument list, add the entry iVARARGS */ 2553 /* redimension the argument list, add the entry iVARARGS */
2552 sym->dim.arglist = 2554 tmp = realloc(sym->dim.arglist,
2553 (arginfo *) realloc(sym->dim.arglist, 2555 (argcnt + 2) * sizeof(arginfo));
2554 (argcnt + 2) * sizeof(arginfo)); 2556 if (!tmp)
2555 if (!sym->dim.arglist)
2556 error(103); /* insufficient memory */ 2557 error(103); /* insufficient memory */
2558 sym->dim.arglist = tmp;
2557 sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list 2559 sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list
2558 * terminated */ 2560 * terminated */
2559 sym->dim.arglist[argcnt].ident = iVARARGS; 2561 sym->dim.arglist[argcnt].ident = iVARARGS;