diff options
author | eddyg <[email protected]> | 2009-06-30 01:22:08 +0000 |
---|---|---|
committer | eddyg <[email protected]> | 2009-06-30 01:22:08 +0000 |
commit | e7a1a9f47c475028b6e73f36ed704bc65ca6c77d (patch) | |
tree | fce906f6aaf807dbde9240701f0dff9fdd367cef /libhb/muxmp4.c | |
parent | 13f3624bc5777074f0384bca9f1d2c2477e91219 (diff) |
Fix subtitle markup memory leak
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2647 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/muxmp4.c')
-rw-r--r-- | libhb/muxmp4.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index 95318ee81..d4107a070 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); |