* environ.cc (parse_options): Use tmp_pathbuf to allocate buffer.
(regopt): Take tmp buffer as additional argument. (environ_init): Alllcate tmpbuf earlier. Use as temporary buffer in call to regopt. * tls_pbuf.cc (tmp_pathbuf::c_get): Allocate one additional char. (tmp_pathbuf::w_get): Allocate one additional WCHAR. * winf.cc (av::unshift): Use tmp_pathbuf to allocate buffer.
This commit is contained in:
@@ -42,7 +42,7 @@ tmp_pathbuf::c_get ()
|
||||
if (tls_pbuf.c_cnt >= TP_NUM_C_BUFS)
|
||||
api_fatal ("Internal error: TP_NUM_C_BUFS too small.");
|
||||
if (!tls_pbuf.c_buf[tls_pbuf.c_cnt]
|
||||
&& !(tls_pbuf.c_buf[tls_pbuf.c_cnt] = (char *) malloc (NT_MAX_PATH)))
|
||||
&& !(tls_pbuf.c_buf[tls_pbuf.c_cnt] = (char *) malloc (NT_MAX_PATH + 1)))
|
||||
api_fatal ("Internal error: Out of memory for new path buf.");
|
||||
return tls_pbuf.c_buf[tls_pbuf.c_cnt++];
|
||||
}
|
||||
@@ -54,7 +54,7 @@ tmp_pathbuf::w_get ()
|
||||
api_fatal ("Internal error: TP_NUM_W_BUFS too small.");
|
||||
if (!tls_pbuf.w_buf[tls_pbuf.w_cnt]
|
||||
&& !(tls_pbuf.w_buf[tls_pbuf.w_cnt]
|
||||
= (PWCHAR) malloc (NT_MAX_PATH * sizeof (WCHAR))))
|
||||
= (PWCHAR) malloc ((NT_MAX_PATH + 1) * sizeof (WCHAR))))
|
||||
api_fatal ("Internal error: Out of memory for new wide path buf.");
|
||||
return tls_pbuf.w_buf[tls_pbuf.w_cnt++];
|
||||
}
|
||||
|
Reference in New Issue
Block a user