Displaying 4 results from an estimated 4 matches for "safe_realloc_add_2op_".
2018 Jul 18
3
Behavior of safe_realloc_add_2op_()
I'm looking at an issue reported by the Coverity static analyzer.
In iconvert() in src/share/utf8/iconvert.c on line 152 there is
newbuf = safe_realloc_add_2op_(utfbuf, ...);
If the request size is not valid, the function will free utfbuf and
return 0. This is followed by goto fail and utfbuf is freed for the
second time. A simply fix would be to set utfbuf to 0 if newbuf is 0.
However, this would create a leak in the case when the size is ok, but
the rea...
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 safe_realloc_(ptr, size2);
}
static inline void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
--
2.17.1
2007 Sep 11
2
include/share/alloc.h
...'safe_malloc_mul_3op_' defined but not used
../../include/share/alloc.h:128: warning: 'safe_malloc_mul2add_' defined but not used
../../include/share/alloc.h:138: warning: 'safe_malloc_muladd2_' defined but not used
../../include/share/alloc.h:148: warning: 'safe_realloc_add_2op_' defined but not used
../../include/share/alloc.h:156: warning: 'safe_realloc_add_3op_' defined but not used
../../include/share/alloc.h:167: warning: 'safe_realloc_add_4op_' defined but not used
In C (certainly C99, probably also C89) functions that that are defined
&q...
2007 Sep 11
0
include/share/alloc.h
...;
> defined but not used
> ../../include/share/alloc.h:128: warning: 'safe_malloc_mul2add_'
> defined but not used
> ../../include/share/alloc.h:138: warning: 'safe_malloc_muladd2_'
> defined but not used
> ../../include/share/alloc.h:148: warning: 'safe_realloc_add_2op_'
> defined but not used
> ../../include/share/alloc.h:156: warning: 'safe_realloc_add_3op_'
> defined but not used
> ../../include/share/alloc.h:167: warning: 'safe_realloc_add_4op_'
> defined but not used
>
> In C (certainly C99, probably also C89)...