viddec3test: Close the duplicate fd's created from omap_bo_dmabuf
authorAmarinder Bindra <a-bindra@ti.com>
Tue, 11 Mar 2014 13:57:27 +0000 (19:27 +0530)
committerAmarinder Bindra <a-bindra@ti.com>
Thu, 20 Mar 2014 12:05:17 +0000 (17:35 +0530)
omap_bo_dmabuf creates a dup fd for the application and the user
must close the fd after it is done with the usage otherwise there
would be file descriptors leak.
Also, cleaned up the code for the decoder_close function to delete
the decoder related in the correct order.

Signed-off-by: Amarinder Bindra <a-bindra@ti.com>
util/display-kms.c
viddec3test.c

index c0730bc55ae04fcdcf13d0c9902247383109be78..3c9ed10e15f75b032a1730416bcb3ea9e10054da 100644 (file)
@@ -195,8 +195,10 @@ free_buffers(struct display *disp, uint32_t n)
        uint32_t i;
        for (i = 0; i < n; i++) {
                 if (disp->buf[i]) {
+                       close(disp->buf[i]->fd[0]);
                        omap_bo_del(disp->buf[i]->bo[0]);
                        if(disp->multiplanar){
+                               close(disp->buf[i]->fd[1]);
                                omap_bo_del(disp->buf[i]->bo[1]);
                        }
                 }
index 3fae551ffb1177383781b31f786de908eca4516d..cd915ba0052e7877048a2f92ee28822347fd860f 100644 (file)
@@ -86,16 +86,16 @@ decoder_close(struct decoder *decoder)
        /* free output buffers allocated by display */
        disp_free_buffers(decoder->disp,decoder->num_outBuf);
 
-       if (decoder->codec)          VIDDEC3_delete(decoder->codec);
-       if (decoder->engine)         Engine_close(decoder->engine);
-       if (dev)                     dce_deinit(dev);
+       if (decoder->status)         dce_free(decoder->status);
        if (decoder->params)         dce_free(decoder->params);
        if (decoder->dynParams)      dce_free(decoder->dynParams);
-       if (decoder->status)         dce_free(decoder->status);
        if (decoder->inBufs)         dce_free(decoder->inBufs);
        if (decoder->outBufs)        dce_free(decoder->outBufs);
        if (decoder->inArgs)         dce_free(decoder->inArgs);
        if (decoder->outArgs)        dce_free(decoder->outArgs);
+       if (decoder->codec)          VIDDEC3_delete(decoder->codec);
+       if (decoder->engine)         Engine_close(decoder->engine);
+       if (dev)                     dce_deinit(dev);
        if (decoder->input_bo)       omap_bo_del(decoder->input_bo);
        if (decoder->demux)          demux_deinit(decoder->demux);
        if (decoder->disp)           disp_close(decoder->disp);