ffserver.c:661: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `close_connection`.

ffserver.c:661:17: Call
659.                 /* close and free the connection */
660.                 log_connection(c);
661.                 close_connection(c);
                     ^
662.             }
663.         }

ffserver.c:744:1: <LHS trace>
742. }
743. 
744. static void close_connection(HTTPContext *c)
     ^
745. {
746.     HTTPContext **cp, *c1;

ffserver.c:744:1: Global `nb_connections`
  742. }
  743. 
  744. static void close_connection(HTTPContext *c)
       ^
  745. {
  746.     HTTPContext **cp, *c1;

ffserver.c:826:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `close_connection` 
  824.     av_free(c->buffer);
  825.     av_free(c);
  826.     nb_connections--;
           ^
  827. }
  828. 

static void close_connection(HTTPContext *c)
{
    HTTPContext **cp, *c1;
    int i, nb_streams;
    AVFormatContext *ctx;
    URLContext *h;
    AVStream *st;
    cp = &first_http_ctx;
    while ((*cp) != NULL) {
        c1 = *cp;
        if (c1 == c)
            *cp = c->next;
        else
            cp = &c1->next;
    }
    for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
        if (c1->rtsp_c == c)
            c1->rtsp_c = NULL;
    }
    if (c->fd >= 0)
        closesocket(c->fd);
    if (c->fmt_in) {
        for(i=0;i<c->fmt_in->nb_streams;i++) {
            st = c->fmt_in->streams[i];
            if (st->codec->codec)
                avcodec_close(st->codec);
        }
        av_close_input_file(c->fmt_in);
    }
    nb_streams = 0;
    if (c->stream)
        nb_streams = c->stream->nb_streams;
    for(i=0;i<nb_streams;i++) {
        ctx = c->rtp_ctx[i];
        if (ctx) {
            av_write_trailer(ctx);
            av_free(ctx);
        }
        h = c->rtp_handles[i];
        if (h)
            url_close(h);
    }
    ctx = &c->fmt_ctx;
    if (!c->last_packet_sent) {
        if (ctx->oformat) {
            if (url_open_dyn_buf(&ctx->pb) >= 0) {
                av_write_trailer(ctx);
                av_freep(&c->pb_buffer);
                url_close_dyn_buf(ctx->pb, &c->pb_buffer);
            }
        }
    }
    for(i=0; i<ctx->nb_streams; i++)
        av_free(ctx->streams[i]);
    if (c->stream && !c->post && c->stream->stream_type == STREAM_TYPE_LIVE)
        current_bandwidth -= c->stream->bandwidth;
    if (c->state == HTTPSTATE_RECEIVE_DATA && c->stream) {
        c->stream->feed_opened = 0;
        close(c->feed_fd);
    }
    av_freep(&c->pb_buffer);
    av_freep(&c->packet_buffer);
    av_free(c->buffer);
    av_free(c);
    nb_connections--;
}
['static int http_server(void)\n{\n    int server_fd = 0, rtsp_server_fd = 0;\n    int ret, delay, delay1;\n    struct pollfd *poll_table, *poll_entry;\n    HTTPContext *c, *c_next;\n    if(!(poll_table = av_mallocz((nb_max_http_connections + 2)*sizeof(*poll_table)))) {\n        http_log("Impossible to allocate a poll table handling %d connections.\\n", nb_max_http_connections);\n        return -1;\n    }\n    if (my_http_addr.sin_port) {\n        server_fd = socket_open_listen(&my_http_addr);\n        if (server_fd < 0)\n            return -1;\n    }\n    if (my_rtsp_addr.sin_port) {\n        rtsp_server_fd = socket_open_listen(&my_rtsp_addr);\n        if (rtsp_server_fd < 0)\n            return -1;\n    }\n    if (!rtsp_server_fd && !server_fd) {\n        http_log("HTTP and RTSP disabled.\\n");\n        return -1;\n    }\n    http_log("ffserver started.\\n");\n    start_children(first_feed);\n    start_multicast();\n    for(;;) {\n        poll_entry = poll_table;\n        if (server_fd) {\n            poll_entry->fd = server_fd;\n            poll_entry->events = POLLIN;\n            poll_entry++;\n        }\n        if (rtsp_server_fd) {\n            poll_entry->fd = rtsp_server_fd;\n            poll_entry->events = POLLIN;\n            poll_entry++;\n        }\n        c = first_http_ctx;\n        delay = 1000;\n        while (c != NULL) {\n            int fd;\n            fd = c->fd;\n            switch(c->state) {\n            case HTTPSTATE_SEND_HEADER:\n            case RTSPSTATE_SEND_REPLY:\n            case RTSPSTATE_SEND_PACKET:\n                c->poll_entry = poll_entry;\n                poll_entry->fd = fd;\n                poll_entry->events = POLLOUT;\n                poll_entry++;\n                break;\n            case HTTPSTATE_SEND_DATA_HEADER:\n            case HTTPSTATE_SEND_DATA:\n            case HTTPSTATE_SEND_DATA_TRAILER:\n                if (!c->is_packetized) {\n                    c->poll_entry = poll_entry;\n                    poll_entry->fd = fd;\n                    poll_entry->events = POLLOUT;\n                    poll_entry++;\n                } else {\n                    delay1 = 10;\n                    if (delay1 < delay)\n                        delay = delay1;\n                }\n                break;\n            case HTTPSTATE_WAIT_REQUEST:\n            case HTTPSTATE_RECEIVE_DATA:\n            case HTTPSTATE_WAIT_FEED:\n            case RTSPSTATE_WAIT_REQUEST:\n                c->poll_entry = poll_entry;\n                poll_entry->fd = fd;\n                poll_entry->events = POLLIN;\n                poll_entry++;\n                break;\n            default:\n                c->poll_entry = NULL;\n                break;\n            }\n            c = c->next;\n        }\n        do {\n            ret = poll(poll_table, poll_entry - poll_table, delay);\n            if (ret < 0 && ff_neterrno() != FF_NETERROR(EAGAIN) &&\n                ff_neterrno() != FF_NETERROR(EINTR))\n                return -1;\n        } while (ret < 0);\n        cur_time = av_gettime() / 1000;\n        if (need_to_start_children) {\n            need_to_start_children = 0;\n            start_children(first_feed);\n        }\n        for(c = first_http_ctx; c != NULL; c = c_next) {\n            c_next = c->next;\n            if (handle_connection(c) < 0) {\n                log_connection(c);\n                close_connection(c);\n            }\n        }\n        poll_entry = poll_table;\n        if (server_fd) {\n            if (poll_entry->revents & POLLIN)\n                new_connection(server_fd, 0);\n            poll_entry++;\n        }\n        if (rtsp_server_fd) {\n            if (poll_entry->revents & POLLIN)\n                new_connection(rtsp_server_fd, 1);\n        }\n    }\n}', 'static void close_connection(HTTPContext *c)\n{\n    HTTPContext **cp, *c1;\n    int i, nb_streams;\n    AVFormatContext *ctx;\n    URLContext *h;\n    AVStream *st;\n    cp = &first_http_ctx;\n    while ((*cp) != NULL) {\n        c1 = *cp;\n        if (c1 == c)\n            *cp = c->next;\n        else\n            cp = &c1->next;\n    }\n    for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {\n        if (c1->rtsp_c == c)\n            c1->rtsp_c = NULL;\n    }\n    if (c->fd >= 0)\n        closesocket(c->fd);\n    if (c->fmt_in) {\n        for(i=0;i<c->fmt_in->nb_streams;i++) {\n            st = c->fmt_in->streams[i];\n            if (st->codec->codec)\n                avcodec_close(st->codec);\n        }\n        av_close_input_file(c->fmt_in);\n    }\n    nb_streams = 0;\n    if (c->stream)\n        nb_streams = c->stream->nb_streams;\n    for(i=0;i<nb_streams;i++) {\n        ctx = c->rtp_ctx[i];\n        if (ctx) {\n            av_write_trailer(ctx);\n            av_free(ctx);\n        }\n        h = c->rtp_handles[i];\n        if (h)\n            url_close(h);\n    }\n    ctx = &c->fmt_ctx;\n    if (!c->last_packet_sent) {\n        if (ctx->oformat) {\n            if (url_open_dyn_buf(&ctx->pb) >= 0) {\n                av_write_trailer(ctx);\n                av_freep(&c->pb_buffer);\n                url_close_dyn_buf(ctx->pb, &c->pb_buffer);\n            }\n        }\n    }\n    for(i=0; i<ctx->nb_streams; i++)\n        av_free(ctx->streams[i]);\n    if (c->stream && !c->post && c->stream->stream_type == STREAM_TYPE_LIVE)\n        current_bandwidth -= c->stream->bandwidth;\n    if (c->state == HTTPSTATE_RECEIVE_DATA && c->stream) {\n        c->stream->feed_opened = 0;\n        close(c->feed_fd);\n    }\n    av_freep(&c->pb_buffer);\n    av_freep(&c->packet_buffer);\n    av_free(c->buffer);\n    av_free(c);\n    nb_connections--;\n}']