Replace "if(buf) realloc(buf, size) else malloc(size)" with realloc()
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
04a04e1628
commit
433dddcf29
5
os/log.c
5
os/log.c
|
@ -305,10 +305,7 @@ LogVWrite(int verb, const char *f, va_list args)
|
||||||
if (len > bufferUnused) {
|
if (len > bufferUnused) {
|
||||||
bufferSize += 1024;
|
bufferSize += 1024;
|
||||||
bufferUnused += 1024;
|
bufferUnused += 1024;
|
||||||
if (saveBuffer)
|
saveBuffer = realloc(saveBuffer, bufferSize);
|
||||||
saveBuffer = realloc(saveBuffer, bufferSize);
|
|
||||||
else
|
|
||||||
saveBuffer = malloc(bufferSize);
|
|
||||||
if (!saveBuffer)
|
if (!saveBuffer)
|
||||||
FatalError("realloc() failed while saving log messages\n");
|
FatalError("realloc() failed while saving log messages\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user