file->name,
file->offset,
strerror(errno));
- free(buf);
return LDPS_ERR;
}
- if (!lto_module_is_object_file_in_memory(buf, file->filesize)) {
- free(buf);
+ if (!lto_module_is_object_file_in_memory(buf, file->filesize))
return LDPS_OK;
- }
} else if (!lto_module_is_object_file(file->name))
return LDPS_OK;
cf.M = buf ? lto_module_create_from_memory(buf, file->filesize) :
lto_module_create(file->name);
+ free(buf);
if (!cf.M) {
(*message)(LDPL_ERROR, "Failed to create LLVM module: %s",
lto_get_error_message());
break;
default:
(*message)(LDPL_ERROR, "Unknown scope attribute: %d", scope);
- free(buf);
return LDPS_ERR;
}
break;
default:
(*message)(LDPL_ERROR, "Unknown definition attribute: %d", definition);
- free(buf);
return LDPS_ERR;
}
if (!cf.syms.empty()) {
if ((*add_symbols)(cf.handle, cf.syms.size(), &cf.syms[0]) != LDPS_OK) {
(*message)(LDPL_ERROR, "Unable to add symbols!");
- free(buf);
return LDPS_ERR;
}
}