Another place we might be running into trouble is here: https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c#105-139 If there is a failure anywhere in that code block, we will not put the nr_ice_media_stream into pctx->peer_streams, so it will leak. However, the question is whether anything is left holding a reference to it. From here: https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c#118 It looks like nr_ice_peer_ctx_parse_stream_attributes_int will eventually end up here, so we have a candidate with a reference: https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/media/mtransport/third_party/nICEr/src/ice/ice_parser.c#133 If this code then succeeds, this candidate is registered with the component: https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c#182-226 So it seems that leaking the nr_ice_media_stream could be dangerous here. Probably needs a fix.
Bug 1624405 Comment 29 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Another place we might be running into trouble is here: https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c#105-139 If there is a failure anywhere in that code block, we will not put the nr_ice_media_stream into pctx->peer_streams, so it will leak. However, the question is whether anything is left holding a reference to it. From here: https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c#118 It looks like nr_ice_peer_ctx_parse_stream_attributes_int will eventually end up here, so we have a candidate with a reference: https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/media/mtransport/third_party/nICEr/src/ice/ice_parser.c#133 If this code then succeeds, this candidate is registered with the component: https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c#182-226 So it seems that leaking the nr_ice_media_stream could be dangerous here. Probably needs a fix. It only looks like this will happen on OOM, so maybe this isn't our culprit.