From: eddyg Date: Tue, 30 Jun 2009 01:22:08 +0000 (+0000) Subject: Fix subtitle markup memory leak X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;h=08af782f6c09e80fa0f9d944741038817202a5a6;p=handbrake-jp%2Fhandbrake-jp-git.git Fix subtitle markup memory leak git-svn-id: svn://localhost/HandBrake/trunk@2647 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index 95318ee8..d4107a07 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -554,7 +554,7 @@ static void hb_makestylerecord( stylerecord **stack, static void hb_makestyleatom( stylerecord *record, uint8_t *style) { uint8_t face = 1; - hb_deep_log(3, "Made style '%s' from %d to %d\n", + hb_deep_log(3, "Made style '%s' from %d to %d", record->style == ITALIC ? "Italic" : record->style == BOLD ? "Bold" : "Underline", record->start, record->stop); switch( record->style ) @@ -599,8 +599,8 @@ static void hb_muxmp4_process_subtitle_style( uint8_t *input, uint8_t *reader = input; uint8_t *writer = output; uint8_t stylecount = 0; - stylerecord *stylestack = NULL; + stylerecord *oldrecord = NULL; while(*reader != '\0') { if (*reader == '<') { @@ -644,7 +644,9 @@ static void hb_muxmp4_process_subtitle_style( uint8_t *input, memcpy(style + 10 + (12 * stylecount), style_record, 12); stylecount++; + oldrecord = stylestack; stylestack = stylestack->next; + free(oldrecord); } else { hb_error("Mismatched Subtitle markup '%s'", input); } @@ -662,8 +664,9 @@ static void hb_muxmp4_process_subtitle_style( uint8_t *input, memcpy(style + 10 + (12 * stylecount), style_record, 12); stylecount++; - + oldrecord = stylestack; stylestack = stylestack->next; + free(oldrecord); } else { hb_error("Mismatched Subtitle markup '%s'", input); } @@ -683,7 +686,9 @@ static void hb_muxmp4_process_subtitle_style( uint8_t *input, memcpy(style + 10 + (12 * stylecount), style_record, 12); stylecount++; + oldrecord = stylestack; stylestack = stylestack->next; + free(oldrecord); } else { hb_error("Mismatched Subtitle markup '%s'", input); } @@ -904,8 +909,6 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, (float)buf->start / 90000, buf->start, buf->stop, (buf->stop - buf->start), buffer); - hb_log("MuxMP4: sub len: %d, style_len %d", buffersize, stylesize); - /* Write the subtitle sample */ memcpy( output + 2, buffer, buffersize ); memcpy( output + 2 + buffersize, styleatom, stylesize);