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

This commit is contained in:
Thomas Schmitt 2015-10-09 20:35:15 +02:00
parent 48453ef1da
commit 78d2c02ad8
1 changed files with 9 additions and 7 deletions

View File

@ -3047,21 +3047,23 @@ int iso_file_make_md5(IsoFile *file, int flag)
if (file->from_old_session)
dig = 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;
}
ret = 1;
ex:;
return ret;
}
return 1;
}