/*
* Copyright (C) 2012, 2013 Eric Biggers
*
- * This file is part of wimlib, a library for working with WIM files.
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option) any
+ * later version.
*
- * wimlib is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 3 of the License, or (at your option) any later
- * version.
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
*
- * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * wimlib; if not, see http://www.gnu.org/licenses/.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this file; if not, see http://www.gnu.org/licenses/.
*/
#ifdef HAVE_CONFIG_H
if (ret)
goto out_free_dentry_tree;
- image_for_each_inode(inode, imd) {
- ret = verify_inode(inode, sd);
- if (ret)
- goto out_free_dentry_tree;
- }
+ image_for_each_inode(inode, imd)
+ check_inode(inode, sd);
/* Success; fill in the image_metadata structure. */
imd->root_dentry = root;
int ret;
u64 subdir_offset;
struct wim_dentry *root;
- u64 len;
+ size_t len;
struct wim_security_data *sd;
struct wim_image_metadata *imd;
len = subdir_offset;
/* Allocate a buffer to contain the uncompressed metadata resource. */
- buf = MALLOC(len);
+ buf = NULL;
+ if (likely(len == subdir_offset))
+ buf = MALLOC(len);
if (!buf) {
ERROR("Failed to allocate %"PRIu64" bytes for "
- "metadata resource", len);
+ "metadata resource", subdir_offset);
return WIMLIB_ERR_NOMEM;
}