Skip to content

Commit f46f151

Browse files
ngorogiannismeta-codesync[bot]
authored andcommitted
[llvm] fix memory leak in patch
Summary: `llvm_di_subprogram_get_type` allocates and then frees an array of pointers. This array is populated with the return values of `getTypeName`, but these were never freed and leaked. Reviewed By: dulmarod Differential Revision: D89554598 fbshipit-source-id: 14864b0b518b15dfca37604a36ec562562248df2
1 parent f31618d commit f46f151

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

dependencies/llvm/opam-repository/packages/conf-llvm/conf-llvm-static.19/opam

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ flags: conf
2727
extra-source "configure.sh" {
2828
src:
2929
"https://raw.githubusercontent.com/ocaml/opam-source-archives/refs/heads/main/patches/conf-llvm/configure.sh.18"
30-
checksum: [
30+
checksum:
3131
"sha256=3675ad30b93aab67f1d57aa7c700800a3b5954768610ef9ef29bba7483f16936"
32-
"md5=409c0a03dcea76a45719b80a06e2bd71"
33-
]
3432
}

dependencies/llvm/opam-repository/packages/llvm/llvm.19-static-infer/opam

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ url {
5858
extra-source "0_AddOCaml.cmake.patch" {
5959
src:
6060
"https://raw.githubusercontent.com/ocaml/opam-source-archives/main/patches/llvm/AddOCaml.cmake.patch.18"
61-
checksum: [
62-
"sha256=a532adaa6938818fbd7f5a49d4de21c0a2d240ecb91636a76b2f745b4b8cb58f"
63-
"md5=432ec376b6ffbac44e640c8fb659a7df"
64-
]
61+
checksum:
62+
"sha256=a532adaa6938818fbd7f5a49d4de21c0a2d240ecb91636a76b2f745b4b8cb58f"
6563
}
6664
extra-source "2_add-LLVMGetAtomicRMWBinOp.patch" {
6765
src: "dependencies/llvm/patches/2_add-LLVMGetAtomicRMWBinOp.patch"
@@ -85,6 +83,6 @@ extra-source "5_getAllocatedType.patch" {
8583
}
8684
extra-source "6_LLVMExtractDISubprogramType.patch" {
8785
src: "dependencies/llvm/patches/6_LLVMExtractDISubprogramType.patch"
88-
checksum: [ "sha256=87e7376b7907435d69e8192c1cdccacb058e7ea0cf7c597acb1165dad700c937"]
86+
checksum: [ "sha256=3590818da43426962c95a86515d7e2e2e78304f4d906c2d096e9892ea0120754"]
8987
}
9088
extra-files: ["install.sh" "sha256=9d4a83c6b661ca4a80289d8a5bc0cddd6dd5d7e25ca9d61a8c358d801e2b8cdf"]

dependencies/llvm/patches/6_LLVMExtractDISubprogramType.patch

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ index ba4a9cbde37a..95f6c18b4bb0 100644
102102
}
103103

104104
value llvm_dibuild_create_compile_unit_bytecode(value *argv, int argn) {
105-
@@ -326,6 +336,19 @@ value llvm_di_location_get_line(value Location) {
105+
@@ -326,6 +336,20 @@ value llvm_di_location_get_line(value Location) {
106106
return Val_int(LLVMDILocationGetLine(Metadata_val(Location)));
107107
}
108108

@@ -114,6 +114,7 @@ index ba4a9cbde37a..95f6c18b4bb0 100644
114114
+ for (unsigned i = 0; i < Length; ++i) {
115115
+ size_t len = strlen(c_array[i]);
116116
+ Field(Array, i) = cstr_to_string(c_array[i], len);
117+
+ free(c_array[i]);
117118
+ }
118119
+ free(c_array);
119120
+ return Array;

opam/llvm.opam.locked

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ extra-source "6_LLVMExtractDISubprogramType.patch" {
122122
src:
123123
"dependencies/llvm/patches/6_LLVMExtractDISubprogramType.patch"
124124
checksum:
125-
"sha256=87e7376b7907435d69e8192c1cdccacb058e7ea0cf7c597acb1165dad700c937"
125+
"sha256=3590818da43426962c95a86515d7e2e2e78304f4d906c2d096e9892ea0120754"
126126
}
127127
extra-files: [
128128
"install.sh"
@@ -131,8 +131,6 @@ extra-files: [
131131
extra-source "0_AddOCaml.cmake.patch" {
132132
src:
133133
"https://raw.githubusercontent.com/ocaml/opam-source-archives/main/patches/llvm/AddOCaml.cmake.patch.18"
134-
checksum: [
134+
checksum:
135135
"sha256=a532adaa6938818fbd7f5a49d4de21c0a2d240ecb91636a76b2f745b4b8cb58f"
136-
"md5=432ec376b6ffbac44e640c8fb659a7df"
137-
]
138136
}

0 commit comments

Comments
 (0)