ack, review only.
/Thanks HansN
On 04/05/2018 04:39 AM, Vu Minh Nguyen wrote:
The allocated memory is not freed before returning from the function
ImmModel::setCcbErrorString().
---
src/imm/immnd/ImmModel.cc | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
Hi Hans,
Now, I got your idea of using RAII for ` fmtError`. Thanks for your comment.
See my responses inline for your comment regarding variable arguments.
Regards, Vu
> -Original Message-
> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
> Sent: Wednesday, April 4, 2018
Hi Zoran,
yes you are right, hm, I didn't check the whole function... /BR Hans
On 04/04/2018 09:57 AM, Zoran Milinkovic wrote:
Hi Hans,
Variable arguments with vsnprintf will work.
The size of the new buffer is resized in
if (len > errLen) {
...
osafassert(vsnprintf(fmtError, len,
Hi Hans,
Variable arguments with vsnprintf will work.
The size of the new buffer is resized in
if (len > errLen) {
...
osafassert(vsnprintf(fmtError, len, errorString, vl) >= 0);
}
when there are variable arguments.
BR,
Zoran
-Original Message-
From: Hans Nordebäck
Sent: den 4
Hi Vu,
not saying that you should change now, but an alternative can be to:
instead of:
char* fmtError = (char*) malloc(errLen);
osafassert(fmtError);
a std::vector can be used, (or a std::array if fixed size):
std::vector fmtError(errLen, 0);
:
len = vsnprintf(fmtError.data(),
Hi Hans, Anders,
Please see my responses inline, with [Vu].
P.s:
Please ignore previous email. I pressed wrong keys...
Regards, Vu
> -Original Message-
> From: Anders Widell [mailto:anders.wid...@ericsson.com]
> Sent: Tuesday, April 3, 2018 7:07 PM
> To: Hans Nordebäck
Hi Hans, Anders,
Please see my responses inline, with [Vu].
Regards, Vu
> -Original Message-
> From: Anders Widell [mailto:anders.wid...@ericsson.com]
> Sent: Tuesday, April 3, 2018 7:07 PM
> To: Hans Nordebäck ; Vu Minh Nguyen
>
Ack with comments. There is actually a second memory leak further down
in this function:
char* newFmtError = (char*)realloc(fmtError, len);
if (newFmtError == nullptr) {
TRACE_5("realloc error ,No memory ");
return;
} else {
When realloc returns nullptr, the original
Hi Vu,
few minor comments below.
/Thanks HansN
On 04/03/2018 11:43 AM, Vu Minh Nguyen wrote:
The allocated memory is not freed before returning from the function
ImmModel::setCcbErrorString().
---
src/imm/immnd/ImmModel.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff