mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
VECTOR: Passing parameters with side effects to macros is dangerous.
* Fix several instances where we were bumping a ref in the parameter and then unrefing the object if it failed. The way the AST_VECTOR_APPEND() and AST_VECTOR_REPLACE() macros are implemented means if it fails the new value was never evaluated. Change-Id: I2847872a455b11ea7e5b7ce697c0a455a1d0ac9a
This commit is contained in:
@@ -2085,7 +2085,9 @@ static void remb_enable_collection(struct ast_bridge *bridge, struct ast_bridge_
|
||||
}
|
||||
}
|
||||
|
||||
if (AST_VECTOR_REPLACE(&softmix_data->remb_collectors, bridge_stream_position, ao2_bump(sc->remb_collector))) {
|
||||
ao2_ref(sc->remb_collector, +1);
|
||||
if (AST_VECTOR_REPLACE(&softmix_data->remb_collectors, bridge_stream_position,
|
||||
sc->remb_collector)) {
|
||||
ao2_ref(sc->remb_collector, -1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user