Skip to content

Commit

Permalink
Fixed memory leak in janus_sdp_get_codec_pt_full, g_list_free(pts) wa…
Browse files Browse the repository at this point in the history
…s not called for early return
  • Loading branch information
vincentfretin committed May 11, 2024
1 parent a7767ad commit 502c14a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sdp-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, const char *codec, const char *p
pts = g_list_append(pts, GINT_TO_POINTER(pt));
} else {
/* Payload type for codec found */
g_list_free(pts);
return pt;
}
}
Expand All @@ -761,6 +762,7 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, const char *codec, const char *p
if(strstr(a->value, profile_id) != NULL) {
/* Found */
JANUS_LOG(LOG_VERB, "VP9 profile %s found --> %d\n", profile, pt);
g_list_free(pts);
return pt;
}
} else if(h264 && strstr(a->value, "packetization-mode=0") == NULL) {
Expand All @@ -772,6 +774,7 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, const char *codec, const char *p
if(strstr(a->value, profile_level_id) != NULL) {
/* Found */
JANUS_LOG(LOG_VERB, "H.264 profile %s found --> %d\n", profile, pt);
g_list_free(pts);
return pt;
}
/* Not found, try converting the profile to upper case */
Expand All @@ -781,15 +784,15 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, const char *codec, const char *p
if(strstr(a->value, profile_level_id) != NULL) {
/* Found */
JANUS_LOG(LOG_VERB, "H.264 profile %s found --> %d\n", profile, pt);
g_list_free(pts);
return pt;
}
}
}
ma = ma->next;
}
}
if(pts != NULL)
g_list_free(pts);
g_list_free(pts);
ml = ml->next;
}
return -1;
Expand Down

0 comments on commit 502c14a

Please sign in to comment.