Browse Source

TT#76711 error-proof codec_handler_free()

Change-Id: Iaaf67bc21bcb904096a30497e817f5527fdf074d
changes/74/38574/7
Richard Fuchs 6 years ago
parent
commit
468fca8ead
3 changed files with 7 additions and 6 deletions
  1. +5
    -2
      daemon/codec.c
  2. +1
    -3
      daemon/media_player.c
  3. +1
    -1
      include/codec.h

+ 5
- 2
daemon/codec.c View File

@ -141,8 +141,11 @@ static void __codec_handler_free(void *pp) {
__handler_shutdown(h);
g_slice_free1(sizeof(*h), h);
}
void codec_handler_free(struct codec_handler *handler) {
__codec_handler_free(handler);
void codec_handler_free(struct codec_handler **handler) {
if (!handler || !*handler)
return;
__codec_handler_free(*handler);
*handler = NULL;
}
static struct codec_handler *__handler_new(const struct rtp_payload_type *pt) {


+ 1
- 3
daemon/media_player.c View File

@ -61,9 +61,7 @@ static void media_player_shutdown(struct media_player *mp) {
}
mp->media = NULL;
if (mp->handler)
codec_handler_free(mp->handler);
mp->handler = NULL;
codec_handler_free(&mp->handler);
if (mp->avioctx) {
if (mp->avioctx->buffer)
av_freep(&mp->avioctx->buffer);


+ 1
- 1
include/codec.h View File

@ -54,7 +54,7 @@ struct codec_handler *codec_handler_get(struct call_media *, int payload_type);
void codec_handlers_free(struct call_media *);
struct codec_handler *codec_handler_make_playback(const struct rtp_payload_type *src_pt,
const struct rtp_payload_type *dst_pt, unsigned long ts);
void codec_handler_free(struct codec_handler *handler);
void codec_handler_free(struct codec_handler **handler);
void ensure_codec_def(struct rtp_payload_type *pt, struct call_media *media);
void codec_add_raw_packet(struct media_packet *mp);


Loading…
Cancel
Save