Fix bad memory handling in traceCommand
This commit is contained in:
1 parent
4f411f66ca
commit
8a91653f13
1 file changed
+2
-1
@@ -286,12 +286,13 @@ void traceCommand(char *id, char *format, ...)
|
||||
va_end(argptr);
|
||||
if(len >= sizeof(buffer)){
|
||||
buf = malloc(len+1);
|
||||
memset(buf,0,len+1);
|
||||
if(buf != NULL){
|
||||
memset(buf,0,len+1);
|
||||
va_start(argptr,format);
|
||||
len = vsnprintf(buf, len+1,format,argptr);
|
||||
va_end(argptr);
|
||||
traceprint("com",id,buf);
|
||||
free(buf);
|
||||
}
|
||||
} else {
|
||||
traceprint("com",id,buffer);
|
||||
|
||||
Reference in new issue
Block a user