CID 5889: The bytes array was leaked.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39985 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2010-12-28 16:44:24 +00:00
parent 5327be44ec
commit edcbc5b0e3

View File

@ -173,8 +173,10 @@ RemoteEventStream::EventReceived(RemoteMessage& message)
if (bytes == NULL) if (bytes == NULL)
break; break;
if (message.ReadList(bytes, numBytes) != B_OK) if (message.ReadList(bytes, numBytes) != B_OK) {
free(bytes);
break; break;
}
for (int32 i = 0; i < numBytes; i++) for (int32 i = 0; i < numBytes; i++)
event->AddInt8("byte", (int8)bytes[i]); event->AddInt8("byte", (int8)bytes[i]);
@ -191,6 +193,7 @@ RemoteEventStream::EventReceived(RemoteMessage& message)
if (message.Read(key) == B_OK) if (message.Read(key) == B_OK)
event->AddInt32("key", key); event->AddInt32("key", key);
free(bytes);
break; break;
} }