ffserver.c:562: error: Resource Leak
  resource acquired to `return` by call to `socket_open_listen()` at line 554, column 21 is not released after line 562, column 13.

ffserver.c:541:1: start of procedure http_server()
539. 
540. /* main loop of the http server */
541. static int http_server(void)
     ^
542. {
543.     int server_fd = 0, rtsp_server_fd = 0;

ffserver.c:543:5: 
541. static int http_server(void)
542. {
543.     int server_fd = 0, rtsp_server_fd = 0;
         ^
544.     int ret, delay, delay1;
545.     struct pollfd *poll_table, *poll_entry;

ffserver.c:548:10: 
546.     HTTPContext *c, *c_next;
547. 
548.     if(!(poll_table = av_mallocz((nb_max_http_connections + 2)*sizeof(*poll_table)))) {
              ^
549.         http_log("Impossible to allocate a poll table handling %d connections.\n", nb_max_http_connections);
550.         return -1;

libavutil/mem.c:132:1: start of procedure av_mallocz()
  130. }
  131. 
  132. void *av_mallocz(unsigned int size)
       ^
  133. {
  134.     void *ptr = av_malloc(size);

libavutil/mem.c:134:5: 
  132. void *av_mallocz(unsigned int size)
  133. {
  134.     void *ptr = av_malloc(size);
           ^
  135.     if (ptr)
  136.         memset(ptr, 0, size);

libavutil/mem.c:42:1: start of procedure av_malloc()
    40.    linker will do it automatically */
    41. 
    42. void *av_malloc(unsigned int size)
        ^
    43. {
    44.     void *ptr;

libavutil/mem.c:50:8: Taking false branch
    48. 
    49.     /* let's disallow possible ambiguous cases */
    50.     if(size > (INT_MAX-16) )
               ^
    51.         return NULL;
    52. 

libavutil/mem.c:61:5: Skipping memalign(): method has no implementation
    59.     ((char*)ptr)[-1]= diff;
    60. #elif defined (HAVE_MEMALIGN)
    61.     ptr = memalign(16,size);
            ^
    62.     /* Why 64?
    63.        Indeed, we should align it:

libavutil/mem.c:91:5: 
    89.     ptr = malloc(size);
    90. #endif
    91.     return ptr;
            ^
    92. }
    93. 

libavutil/mem.c:92:1: return from a call to av_malloc
    90. #endif
    91.     return ptr;
    92. }
        ^
    93. 
    94. void *av_realloc(void *ptr, unsigned int size)

libavutil/mem.c:135:9: Taking true branch
  133. {
  134.     void *ptr = av_malloc(size);
  135.     if (ptr)
               ^
  136.         memset(ptr, 0, size);
  137.     return ptr;

libavutil/mem.c:136:9: 
  134.     void *ptr = av_malloc(size);
  135.     if (ptr)
  136.         memset(ptr, 0, size);
               ^
  137.     return ptr;
  138. }

libavutil/mem.c:137:5: 
  135.     if (ptr)
  136.         memset(ptr, 0, size);
  137.     return ptr;
           ^
  138. }
  139. 

libavutil/mem.c:138:1: return from a call to av_mallocz
  136.         memset(ptr, 0, size);
  137.     return ptr;
  138. }
       ^
  139. 
  140. char *av_strdup(const char *s)

ffserver.c:548:10: Taking false branch
546.     HTTPContext *c, *c_next;
547. 
548.     if(!(poll_table = av_mallocz((nb_max_http_connections + 2)*sizeof(*poll_table)))) {
              ^
549.         http_log("Impossible to allocate a poll table handling %d connections.\n", nb_max_http_connections);
550.         return -1;

ffserver.c:553:9: Taking true branch
551.     }
552. 
553.     if (my_http_addr.sin_port) {
             ^
554.         server_fd = socket_open_listen(&my_http_addr);
555.         if (server_fd < 0)

ffserver.c:554:9: 
552. 
553.     if (my_http_addr.sin_port) {
554.         server_fd = socket_open_listen(&my_http_addr);
             ^
555.         if (server_fd < 0)
556.             return -1;

ffserver.c:454:1: start of procedure socket_open_listen()
  452. 
  453. /* open a listening socket */
  454. static int socket_open_listen(struct sockaddr_in *my_addr)
       ^
  455. {
  456.     int server_fd, tmp;

ffserver.c:458:5: 
  456.     int server_fd, tmp;
  457. 
  458.     server_fd = socket(AF_INET,SOCK_STREAM,0);
           ^
  459.     if (server_fd < 0) {
  460.         perror ("socket");

ffserver.c:459:9: Taking false branch
  457. 
  458.     server_fd = socket(AF_INET,SOCK_STREAM,0);
  459.     if (server_fd < 0) {
               ^
  460.         perror ("socket");
  461.         return -1;

ffserver.c:464:5: 
  462.     }
  463. 
  464.     tmp = 1;
           ^
  465.     setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
  466. 

ffserver.c:465:5: Skipping setsockopt(): method has no implementation
  463. 
  464.     tmp = 1;
  465.     setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
           ^
  466. 
  467.     if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) {

ffserver.c:467:9: Taking false branch
  465.     setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
  466. 
  467.     if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) {
               ^
  468.         char bindmsg[32];
  469.         snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)", ntohs(my_addr->sin_port));

ffserver.c:475:9: Taking false branch
  473.     }
  474. 
  475.     if (listen (server_fd, 5) < 0) {
               ^
  476.         perror ("listen");
  477.         closesocket(server_fd);

ffserver.c:480:5: 
  478.         return -1;
  479.     }
  480.     ff_socket_nonblock(server_fd, 1);
           ^
  481. 
  482.     return server_fd;

libavformat/os_support.c:77:1: start of procedure ff_socket_nonblock()
    75. }
    76. 
    77. int ff_socket_nonblock(int socket, int enable)
        ^
    78. {
    79. #ifdef HAVE_WINSOCK2_H

libavformat/os_support.c:82:8: Taking true branch
    80.    return ioctlsocket(socket, FIONBIO, &enable);
    81. #else
    82.    if (enable)
               ^
    83.       return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
    84.    else

libavformat/os_support.c:83:7: 
    81. #else
    82.    if (enable)
    83.       return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
              ^
    84.    else
    85.       return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);

libavformat/os_support.c:87:1: return from a call to ff_socket_nonblock
    85.       return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
    86. #endif
    87. }
        ^
    88. #endif /* CONFIG_NETWORK */
    89. 

ffserver.c:482:5: 
  480.     ff_socket_nonblock(server_fd, 1);
  481. 
  482.     return server_fd;
           ^
  483. }
  484. 

ffserver.c:483:1: return from a call to socket_open_listen
  481. 
  482.     return server_fd;
  483. }
       ^
  484. 
  485. /* start all multicast streams */

ffserver.c:555:13: Taking false branch
553.     if (my_http_addr.sin_port) {
554.         server_fd = socket_open_listen(&my_http_addr);
555.         if (server_fd < 0)
                 ^
556.             return -1;
557.     }

ffserver.c:559:9: Taking true branch
557.     }
558. 
559.     if (my_rtsp_addr.sin_port) {
             ^
560.         rtsp_server_fd = socket_open_listen(&my_rtsp_addr);
561.         if (rtsp_server_fd < 0)

ffserver.c:560:9: 
558. 
559.     if (my_rtsp_addr.sin_port) {
560.         rtsp_server_fd = socket_open_listen(&my_rtsp_addr);
             ^
561.         if (rtsp_server_fd < 0)
562.             return -1;

ffserver.c:454:1: start of procedure socket_open_listen()
  452. 
  453. /* open a listening socket */
  454. static int socket_open_listen(struct sockaddr_in *my_addr)
       ^
  455. {
  456.     int server_fd, tmp;

ffserver.c:458:5: 
  456.     int server_fd, tmp;
  457. 
  458.     server_fd = socket(AF_INET,SOCK_STREAM,0);
           ^
  459.     if (server_fd < 0) {
  460.         perror ("socket");

ffserver.c:459:9: Taking true branch
  457. 
  458.     server_fd = socket(AF_INET,SOCK_STREAM,0);
  459.     if (server_fd < 0) {
               ^
  460.         perror ("socket");
  461.         return -1;

ffserver.c:460:9: 
  458.     server_fd = socket(AF_INET,SOCK_STREAM,0);
  459.     if (server_fd < 0) {
  460.         perror ("socket");
               ^
  461.         return -1;
  462.     }

ffserver.c:461:9: 
  459.     if (server_fd < 0) {
  460.         perror ("socket");
  461.         return -1;
               ^
  462.     }
  463. 

ffserver.c:483:1: return from a call to socket_open_listen
  481. 
  482.     return server_fd;
  483. }
       ^
  484. 
  485. /* start all multicast streams */

ffserver.c:561:13: Taking true branch
559.     if (my_rtsp_addr.sin_port) {
560.         rtsp_server_fd = socket_open_listen(&my_rtsp_addr);
561.         if (rtsp_server_fd < 0)
                 ^
562.             return -1;
563.     }

ffserver.c:562:13: 
560.         rtsp_server_fd = socket_open_listen(&my_rtsp_addr);
561.         if (rtsp_server_fd < 0)
562.             return -1;
                 ^
563.     }
564. 
