Browse Source

Closed memory leak with error in iso_file_make_md5(). Coverity CID 12573.

release-1.5.4.branch
Thomas Schmitt 6 years ago
parent
commit
78d2c02ad8
  1. 16
      libisofs/node.c

16
libisofs/node.c

@ -3046,21 +3046,23 @@ int iso_file_make_md5(IsoFile *file, int flag)
if (file->from_old_session)
dig = 1;
md5= calloc(16, 1);
md5 = calloc(16, 1);
if (md5 == NULL)
return ISO_OUT_OF_MEM;
ret = iso_stream_make_md5(file->stream, md5, dig);
if (ret < 0)
goto ex;
if (ret < 0) {
free(md5);
return ret;
}
iso_node_remove_xinfo((IsoNode *) file, checksum_md5_xinfo_func);
ret = iso_node_add_xinfo((IsoNode *) file, checksum_md5_xinfo_func, md5);
if (ret == 0)
ret = ISO_ERROR; /* should not happen after iso_node_remove_xinfo() */
if (ret < 0) {
free(md5);
goto ex;
return ret;
}
ret = 1;
ex:;
return ret;
return 1;
}

Loading…
Cancel
Save