libavformat/hlsenc.c:440: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `avformat_free_context`.

libavformat/hlsenc.c:416:20: Call
414.                "expect issues decoding it.\n");
415. 
416.     hls->oformat = av_guess_format("mpegts", NULL, NULL);
                        ^
417. 
418.     if (!hls->oformat) {

libavformat/format.c:115:16: Unknown value from: av_guess_format
  113.         av_filename_number_test(filename) &&
  114.         ff_guess_image2_codec(filename) != AV_CODEC_ID_NONE) {
  115.         return av_guess_format("image2", NULL, NULL);
                      ^
  116.     }
  117. #endif

libavformat/hlsenc.c:440:13: Call
438.         av_free(hls->basename);
439.         if (hls->avf)
440.             avformat_free_context(hls->avf);
                 ^
441. 
442.         free_encryption(s);

libavformat/utils.c:2705:1: <LHS trace>
2703. }
2704. 
2705. void avformat_free_context(AVFormatContext *s)
      ^
2706. {
2707.     int i;

libavformat/utils.c:2705:1: Parameter `s->nb_programs`
  2703. }
  2704. 
  2705. void avformat_free_context(AVFormatContext *s)
        ^
  2706. {
  2707.     int i;

libavformat/utils.c:2719:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_free_context` 
  2717.         free_stream(&s->streams[i]);
  2718. 
  2719.     for (i = s->nb_programs - 1; i >= 0; i--) {
                 ^
  2720.         av_dict_free(&s->programs[i]->metadata);
  2721.         av_freep(&s->programs[i]->stream_index);

void avformat_free_context(AVFormatContext *s)
{
    int i;
    if (!s)
        return;
    av_opt_free(s);
    if (s->iformat && s->iformat->priv_class && s->priv_data)
        av_opt_free(s->priv_data);
    for (i = 0; i < s->nb_streams; i++)
        free_stream(&s->streams[i]);
    for (i = s->nb_programs - 1; i >= 0; i--) {
        av_dict_free(&s->programs[i]->metadata);
        av_freep(&s->programs[i]->stream_index);
        av_freep(&s->programs[i]);
    }
    av_freep(&s->programs);
    av_freep(&s->priv_data);
    while (s->nb_chapters--) {
        av_dict_free(&s->chapters[s->nb_chapters]->metadata);
        av_free(s->chapters[s->nb_chapters]);
    }
    av_freep(&s->chapters);
    av_dict_free(&s->metadata);
    av_freep(&s->streams);
    av_freep(&s->internal);
    av_free(s);
}
['static int hls_write_header(AVFormatContext *s)\n{\n    HLSContext *hls = s->priv_data;\n    int ret, i;\n    hls->sequence       = hls->start_sequence;\n    hls->recording_time = hls->time * AV_TIME_BASE;\n    hls->start_pts      = AV_NOPTS_VALUE;\n    for (i = 0; i < s->nb_streams; i++)\n        hls->has_video +=\n            s->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO;\n    if (hls->has_video > 1)\n        av_log(s, AV_LOG_WARNING,\n               "More than a single video stream present, "\n               "expect issues decoding it.\\n");\n    hls->oformat = av_guess_format("mpegts", NULL, NULL);\n    if (!hls->oformat) {\n        ret = AVERROR_MUXER_NOT_FOUND;\n        goto fail;\n    }\n    if ((ret = hls_setup(s)) < 0)\n        goto fail;\n    if ((ret = hls_mux_init(s)) < 0)\n        goto fail;\n    if ((ret = hls_start(s)) < 0)\n        goto fail;\n    if ((ret = avformat_write_header(hls->avf, NULL)) < 0)\n        return ret;\nfail:\n    if (ret) {\n        av_free(hls->basename);\n        if (hls->avf)\n            avformat_free_context(hls->avf);\n        free_encryption(s);\n    }\n    return ret;\n}', 'AVOutputFormat *av_guess_format(const char *short_name, const char *filename,\n                                const char *mime_type)\n{\n    AVOutputFormat *fmt = NULL, *fmt_found;\n    int score_max, score;\n#if CONFIG_IMAGE2_MUXER\n    if (!short_name && filename &&\n        av_filename_number_test(filename) &&\n        ff_guess_image2_codec(filename) != AV_CODEC_ID_NONE) {\n        return av_guess_format("image2", NULL, NULL);\n    }\n#endif\n    fmt_found = NULL;\n    score_max = 0;\n    while ((fmt = av_oformat_next(fmt))) {\n        score = 0;\n        if (fmt->name && short_name && !av_strcasecmp(fmt->name, short_name))\n            score += 100;\n        if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type))\n            score += 10;\n        if (filename && fmt->extensions &&\n            av_match_ext(filename, fmt->extensions)) {\n            score += 5;\n        }\n        if (score > score_max) {\n            score_max = score;\n            fmt_found = fmt;\n        }\n    }\n    return fmt_found;\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i;\n    if (!s)\n        return;\n    av_opt_free(s);\n    if (s->iformat && s->iformat->priv_class && s->priv_data)\n        av_opt_free(s->priv_data);\n    for (i = 0; i < s->nb_streams; i++)\n        free_stream(&s->streams[i]);\n    for (i = s->nb_programs - 1; i >= 0; i--) {\n        av_dict_free(&s->programs[i]->metadata);\n        av_freep(&s->programs[i]->stream_index);\n        av_freep(&s->programs[i]);\n    }\n    av_freep(&s->programs);\n    av_freep(&s->priv_data);\n    while (s->nb_chapters--) {\n        av_dict_free(&s->chapters[s->nb_chapters]->metadata);\n        av_free(s->chapters[s->nb_chapters]);\n    }\n    av_freep(&s->chapters);\n    av_dict_free(&s->metadata);\n    av_freep(&s->streams);\n    av_freep(&s->internal);\n    av_free(s);\n}']