[llvm-commits] [llvm] r63907 - /llvm/trunk/tools/gold/gold-plugin.cpp
Nick Lewycky
nicholas at mxc.ca
Thu Feb 5 17:58:34 PST 2009
Author: nicholas
Date: Thu Feb 5 19:58:34 2009
New Revision: 63907
URL: http://llvm.org/viewvc/llvm-project?rev=63907&view=rev
Log:
Free the buffer.
Modified:
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=63907&r1=63906&r2=63907&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Feb 5 19:58:34 2009
@@ -180,13 +180,10 @@
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;
@@ -196,6 +193,7 @@
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());
@@ -229,7 +227,6 @@
break;
default:
(*message)(LDPL_ERROR, "Unknown scope attribute: %d", scope);
- free(buf);
return LDPS_ERR;
}
@@ -249,7 +246,6 @@
break;
default:
(*message)(LDPL_ERROR, "Unknown definition attribute: %d", definition);
- free(buf);
return LDPS_ERR;
}
@@ -265,7 +261,6 @@
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;
}
}
More information about the llvm-commits
mailing list