mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the ptr array free, 0.9.96
This commit is contained in:
parent
dc66c525fd
commit
3ebda13802
5 changed files with 58 additions and 49 deletions
|
@ -474,6 +474,7 @@ int SrsEdgeForwarder::cycle()
|
|||
srs_verbose("no packets to forward.");
|
||||
continue;
|
||||
}
|
||||
SrsAutoFreeArray(SrsSharedPtrMessage, msgs, count);
|
||||
|
||||
// all msgs to forward to origin.
|
||||
// @remark, becareful, all msgs must be free explicitly,
|
||||
|
@ -484,23 +485,11 @@ int SrsEdgeForwarder::cycle()
|
|||
srs_assert(msg);
|
||||
msgs[i] = NULL;
|
||||
|
||||
// never use free msgs array, for it will memory leak.
|
||||
// if error, directly free msgs.
|
||||
if (ret != ERROR_SUCCESS) {
|
||||
srs_freep(msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ret = client->send_and_free_message(msg)) != ERROR_SUCCESS) {
|
||||
srs_error("edge publish forwarder send message to server failed. ret=%d", ret);
|
||||
continue;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
// free the array itself.
|
||||
srs_freep(msgs);
|
||||
if (ret != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue