FlushWithReply(ReplyData *) checks for non-NULL buffers - eliminates a memory leak
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2902 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -344,7 +344,11 @@ printf("\tFlushWithReply(): unable to assign reply port to data\n");
|
|||||||
{
|
{
|
||||||
data->buffersize=port_buffer_size(replyport);
|
data->buffersize=port_buffer_size(replyport);
|
||||||
if(data->buffersize>0)
|
if(data->buffersize>0)
|
||||||
|
{
|
||||||
|
if(data->buffer)
|
||||||
|
delete data->buffer;
|
||||||
data->buffer=(int8*)new int8[data->buffersize];
|
data->buffer=(int8*)new int8[data->buffersize];
|
||||||
|
}
|
||||||
read_port(replyport,&(data->code),data->buffer, data->buffersize);
|
read_port(replyport,&(data->code),data->buffer, data->buffersize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -354,7 +358,9 @@ printf("\tFlushWithReply(): unable to assign reply port to data\n");
|
|||||||
return B_TIMED_OUT;
|
return B_TIMED_OUT;
|
||||||
|
|
||||||
if(data->buffersize>0)
|
if(data->buffersize>0)
|
||||||
|
{
|
||||||
data->buffer=(int8*)new int8[data->buffersize];
|
data->buffer=(int8*)new int8[data->buffersize];
|
||||||
|
}
|
||||||
read_port(replyport,&(data->code),data->buffer, data->buffersize);
|
read_port(replyport,&(data->code),data->buffer, data->buffersize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user