1 diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c |
1 This patch has been developed inhouse. This fixes a Solaris |
2 --- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c 2012-05-02 03:34:48.830258020 -0700 |
2 specific issue and has not been submitted to the community. |
3 +++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c 2012-05-02 03:42:51.584924888 -0700 |
3 --- INIT.2012-08-01.old/src/cmd/ksh93/sh/macro.c 2015-02-24 13:25:19.363200741 -0800 |
4 @@ -1084,7 +1084,7 @@ static int varsub(Mac_t *mp) |
4 +++ INIT.2012-08-01/src/cmd/ksh93/sh/macro.c 2015-03-05 11:11:46.044880541 -0800 |
|
5 @@ -1086,7 +1086,7 @@ static int varsub(Mac_t *mp) |
5 { |
6 { |
6 register int c; |
7 register int c; |
7 register int type=0; /* M_xxx */ |
8 register int type=0; /* M_xxx */ |
8 - register char *v,*argp=0; |
9 - register char *v,*argp=0; |
9 + register char *v, *new_v = NULL, *argp=0; |
10 + register char *v, *new_v = NULL, *argp=0; |
10 register Namval_t *np = NIL(Namval_t*); |
11 register Namval_t *np = NIL(Namval_t*); |
11 register int dolg=0, mode=0; |
12 register int dolg=0, mode=0; |
12 Lex_t *lp = (Lex_t*)mp->shp->lex_context; |
13 Lex_t *lp = (Lex_t*)mp->shp->lex_context; |
13 @@ -1436,6 +1436,7 @@ retry1: |
14 @@ -1439,6 +1439,7 @@ retry1: |
14 if( (mp->arith||mp->let) && (np->nvfun || nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL))) && !nv_isattr(np,NV_INTEGER) && (offset==0 || !isalnum(c))) |
15 if((mp->let || (mp->arith&&nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL)))) && !nv_isattr(np,NV_INTEGER) && (offset==0 || isspace(c) || strchr(",.+-*/=%&|^?!<>",c))) |
15 mp->zeros = 1; |
16 mp->zeros = 1; |
16 } |
17 } |
17 + new_v = v = strdup(v); |
18 + new_v = v = strdup(v); |
18 if(savptr==stakptr(0)) |
19 if(savptr==stakptr(0)) |
19 stkseek(stkp,offset); |
20 stkseek(stkp,offset); |
20 else |
21 else |
21 @@ -1963,8 +1964,12 @@ retry2: |
22 @@ -1989,6 +1990,8 @@ retry2: |
22 } |
23 } |
23 if(np) |
24 if(np) |
24 nv_close(np); |
25 nv_close(np); |
25 + if (new_v) |
26 + if (new_v) |
26 + free(new_v); |
27 + free(new_v); |
|
28 if(pattern) |
|
29 free(pattern); |
|
30 if(repstr) |
|
31 @@ -1997,6 +2000,8 @@ retry2: |
|
32 free(idx); |
27 return(1); |
33 return(1); |
28 nosub: |
34 nosub: |
29 + if (new_v) |
35 + if (new_v) |
30 + free(new_v); |
36 + free(new_v); |
31 if(type==M_BRACE && sh_lexstates[ST_NORM][c]==S_BREAK) |
37 if(type==M_BRACE && sh_lexstates[ST_NORM][c]==S_BREAK) |