transcode-1.1.7-preset-free.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. Fix invalid free when preset file not found
  2. https://bugs.gentoo.org/show_bug.cgi?id=322945
  3. Author: Brennan Shacklett
  4. diff -urN transcode-1.1.7-orig/export/export_ffmpeg.c transcode-1.1.7/export/export_ffmpeg.c
  5. --- transcode-1.1.7-orig/export/export_ffmpeg.c 2011-11-19 08:50:27.000000000 -0800
  6. +++ transcode-1.1.7/export/export_ffmpeg.c 2012-07-03 20:07:05.669083945 -0700
  7. @@ -321,7 +321,7 @@
  8. }
  9. if(!f){
  10. - fprintf(stderr, "File for preset '%s' not found\n", arg);
  11. + tc_log_error(MOD_NAME, "File for preset '%s' not found", arg);
  12. av_exit(1);
  13. }
  14. @@ -1207,7 +1207,7 @@
  15. /* FIXME: transcode itself contains "broken ffmpeg default settings", thus we need to override them! */
  16. if (lavc_param_video_preset) {
  17. avcodec_opts[AVMEDIA_TYPE_VIDEO] = lavc_venc_context;
  18. - video_codec_name = ffmpeg_codec_name(codec->name);
  19. + video_codec_name = av_strdup(ffmpeg_codec_name(codec->name));
  20. const char *preset_start = lavc_param_video_preset;
  21. while (preset_start) {
  22. @@ -1225,6 +1225,8 @@
  23. if (opt_preset("vpre", preset_name) != 0) {
  24. tc_log_warn(MOD_NAME, "Parsing ffmpeg preset '%s' failed", preset_name);
  25. }
  26. + av_free(video_codec_name);
  27. + video_codec_name = NULL;
  28. if (verbose) {
  29. int i;
  30. tc_log_info(MOD_NAME, "After parsing preset '%s', %i options are overridden:", preset_name, opt_name_count);