Skip to content

Commit 7a0c60e

Browse files
committed
secp256k1-sys: patch out checked_malloc
1 parent 942a0e5 commit 7a0c60e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

secp256k1-sys/depend/secp256k1/src/util.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,9 @@ static const rustsecp256k1_v0_9_0_callback default_error_callback = {
145145
#endif
146146

147147
static SECP256K1_INLINE void *checked_malloc(const rustsecp256k1_v0_9_0_callback* cb, size_t size) {
148-
void *ret = malloc(size);
149-
if (ret == NULL) {
150-
rustsecp256k1_v0_9_0_callback_call(cb, "Out of memory");
151-
}
152-
return ret;
148+
(void) cb;
149+
(void) size;
150+
return NULL;
153151
}
154152

155153
#if defined(__BIGGEST_ALIGNMENT__)

secp256k1-sys/depend/util.h.patch

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
148,152c148,150
2+
< void *ret = malloc(size);
3+
< if (ret == NULL) {
4+
< secp256k1_callback_call(cb, "Out of memory");
5+
< }
6+
< return ret;
7+
---
8+
> (void) cb;
9+
> (void) size;
10+
> return NULL;

secp256k1-sys/vendor-libsecp.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ echo "$SOURCE_REV" >> ./secp256k1-HEAD-revision.txt
9797
patch "$DIR/include/secp256k1.h" "./secp256k1.h.patch"
9898
patch "$DIR/src/secp256k1.c" "./secp256k1.c.patch"
9999
patch "$DIR/src/scratch_impl.h" "./scratch_impl.h.patch"
100+
patch "$DIR/src/util.h" "./util.h.patch"
100101

101102
# Fix a linking error while cross-compiling to windowns with mingw
102103
patch "$DIR/contrib/lax_der_parsing.c" "./lax_der_parsing.c.patch"

0 commit comments

Comments
 (0)