rtph263pay: fix leak

Free memory of current macroblock once it isn't needed so it isn't leaked
by the call of the gst_rtp_h263_pay_B_mbfinder function.
if (!(mac = gst_rtp_h263_pay_B_mbfinder (context, gob, mac, mb))) {

CID 1212156
This commit is contained in:
Luis de Bethencourt 2016-03-31 14:57:20 +01:00
parent 41d2b6f19e
commit 6a16be75bf

View file

@ -952,19 +952,16 @@ static GstRtpH263PayMB *
gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
GstRtpH263PayGob * gob, GstRtpH263PayMB * macroblock, guint mba)
{
guint mb_type_index;
guint cbpy_type_index;
guint tcoef_type_index;
GstRtpH263PayMB *mac;
GstRtpH263PayBoundry boundry;
gst_rtp_h263_pay_boundry_init (&boundry, macroblock->end,
macroblock->end, 8 - macroblock->ebit, macroblock->ebit);
mac = gst_rtp_h263_pay_mb_new (&boundry, mba);
if (mac->sbit == 8) {
mac->start++;
// mac->end++;
@ -974,6 +971,9 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
GST_LOG ("current_pos:%p, end:%p, rest_bits:%d, window:%x",
mac->start, mac->end, macroblock->ebit, context->window);
/* macroblock isn't needed anymore */
gst_rtp_h263_pay_mb_destroy (macroblock);
GST_LOG ("Current pos after COD: %p", mac->end);
if (context->piclayer->ptype_pictype == 0) {
@ -1225,7 +1225,6 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
return mac;
beach:
gst_rtp_h263_pay_mb_destroy (mac);
return NULL;
}
@ -1589,7 +1588,6 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay,
}
/*---------- END OF MODE B FRAGMENTATION ----------*/
gst_rtp_h263_pay_mb_destroy (mac);
return TRUE;