secp256k1-sys: patch out checked_malloc

This commit is contained in:
Andrew Poelstra 2023-11-06 14:38:49 +00:00
parent 942a0e5e2c
commit 7a0c60edcd
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 14 additions and 5 deletions

View File

@ -145,11 +145,9 @@ static const rustsecp256k1_v0_9_0_callback default_error_callback = {
#endif
static SECP256K1_INLINE void *checked_malloc(const rustsecp256k1_v0_9_0_callback* cb, size_t size) {
void *ret = malloc(size);
if (ret == NULL) {
rustsecp256k1_v0_9_0_callback_call(cb, "Out of memory");
}
return ret;
(void) cb;
(void) size;
return NULL;
}
#if defined(__BIGGEST_ALIGNMENT__)

View File

@ -0,0 +1,10 @@
148,152c148,150
< void *ret = malloc(size);
< if (ret == NULL) {
< secp256k1_callback_call(cb, "Out of memory");
< }
< return ret;
---
> (void) cb;
> (void) size;
> return NULL;

View File

@ -97,6 +97,7 @@ echo "$SOURCE_REV" >> ./secp256k1-HEAD-revision.txt
patch "$DIR/include/secp256k1.h" "./secp256k1.h.patch"
patch "$DIR/src/secp256k1.c" "./secp256k1.c.patch"
patch "$DIR/src/scratch_impl.h" "./scratch_impl.h.patch"
patch "$DIR/src/util.h" "./util.h.patch"
# Fix a linking error while cross-compiling to windowns with mingw
patch "$DIR/contrib/lax_der_parsing.c" "./lax_der_parsing.c.patch"