summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-02-06 01:58:34 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-02-06 01:58:34 +0000
commitea97aa6129fc89292e215d01fa66504195f1a969 (patch)
tree9a488fd4ac3b6ae965af826f3c6c1040c9b341b0 /tools
parent77402d1dbf9b36c3245f3f9b453de89d5caff5fd (diff)
downloadllvm-ea97aa6129fc89292e215d01fa66504195f1a969.tar.gz
llvm-ea97aa6129fc89292e215d01fa66504195f1a969.tar.bz2
llvm-ea97aa6129fc89292e215d01fa66504195f1a969.tar.xz
Free the buffer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/gold/gold-plugin.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index d41cd812bc..69fb0ea641 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -180,13 +180,10 @@ ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
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 @@ ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
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 @@ ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
break;
default:
(*message)(LDPL_ERROR, "Unknown scope attribute: %d", scope);
- free(buf);
return LDPS_ERR;
}
@@ -249,7 +246,6 @@ ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
break;
default:
(*message)(LDPL_ERROR, "Unknown definition attribute: %d", definition);
- free(buf);
return LDPS_ERR;
}
@@ -265,7 +261,6 @@ ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
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;
}
}