Skip to content

Fix fd leak in error path

Bastien Nocera requested to merge wip/hadess/fix-coverity-warnings into master
shared-mime-info-2.1/xdgmime/src/print-mime-data.c:66: alloc_fn: Storage is returned from allocation function "fopen".
shared-mime-info-2.1/xdgmime/src/print-mime-data.c:66: var_assign: Assigning: "file" = storage returned from "fopen(filename, "r")".
shared-mime-info-2.1/xdgmime/src/print-mime-data.c:80: leaked_storage: Variable "file" going out of scope leaks the storage it points to.
   78|       {
   79|         printf ("Failed to allocate memory for file %s\n", filename);
   80|->       return;
   81|       }
   82|

shared-mime-info-2.1/xdgmime/src/test-mime-data.c:113: alloc_fn: Storage is returned from allocation function "fopen".
shared-mime-info-2.1/xdgmime/src/test-mime-data.c:113: var_assign: Assigning: "file" = storage returned from "fopen(path, "r")".
shared-mime-info-2.1/xdgmime/src/test-mime-data.c:131: leaked_storage: Variable "file" going out of scope leaks the storage it points to.
  129|         error++;
  130|
  131|->       return;
  132|       }
  133|

Merge request reports

Loading