Displaying 4 results from an estimated 4 matches for "safe_realloc_mul_2op_".
Did you mean:
safe_malloc_mul_2op_
2015 Jul 06
5
[PATCH] for potential memory leaks
libFLAC has several places like this:
if(0 == (ptr = realloc(ptr, size)))
return false;
which results in memory leaks if realloc fails (the old value of ptr is lost).
The patch should fix this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: realloc_memleak_fix.patch
Type: application/octet-stream
Size: 6272 bytes
Desc: not available
Url :
2018 Jul 20
1
[PATCH 2/2] Fix safe_realloc_add_2op_() to free memory when reallocation fails
---
include/share/alloc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/share/alloc.h b/include/share/alloc.h
index 914de9ba..63878db0 100644
--- a/include/share/alloc.h
+++ b/include/share/alloc.h
@@ -168,7 +168,7 @@ static inline void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2)
free(ptr);
return 0;
}
- return realloc(ptr, size2);
+ return
2012 Apr 05
1
[PATCH] remove unnecesary typedef in bitwriter.c
...fer);
@@ -118,7 +117,7 @@ static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add)
FLAC__ASSERT(new_capacity > bw->capacity);
FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD));
- new_buffer = safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity);
+ new_buffer = safe_realloc_mul_2op_(bw->buffer, sizeof(uint32_t), /*times*/new_capacity);
if(new_buffer == 0)
return false;
bw->buffer = new_buffer;
@@ -160,7 +159,7 @@ FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw)
bw-&...
2007 Dec 04
0
Compilation of flac-1.2.1 fails under MinGW
...lude/share/alloc.h:130: error: `SIZE_T_MAX' undeclared (first
use in th is function)
../../include/share/alloc.h: In function `safe_malloc_mul2add_':
../../include/share/alloc.h:143: error: `SIZE_T_MAX' undeclared (first
use in th is function)
../../include/share/alloc.h: In function `safe_realloc_mul_2op_':
../../include/share/alloc.h:196: error: `SIZE_T_MAX' undeclared (first
use in th is function)
With flac 1.1.3, the compilation succeed
Regards,
Jerome