Commit 1fa5cd3a336e00df36f297650180b811c2564319
1 parent
039c85fb
Exists in
master
and in
2 other branches
Fixing deepcode alert.
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
src/core/util.c
| ... | ... | @@ -180,6 +180,8 @@ LIB3270_EXPORT void lib3270_autoptr_cleanup_LIB3270_POPUP(LIB3270_POPUP **ptr) |
| 180 | 180 | LIB3270_EXPORT void * lib3270_realloc(void *p, int len) |
| 181 | 181 | { |
| 182 | 182 | p = realloc(p, len); |
| 183 | + if(p == NULL) | |
| 184 | + perror("realloc"); | |
| 183 | 185 | return p; |
| 184 | 186 | } |
| 185 | 187 | |
| ... | ... | @@ -192,9 +194,10 @@ LIB3270_EXPORT void * lib3270_calloc(int elsize, int nelem, void *ptr) |
| 192 | 194 | else |
| 193 | 195 | ptr = malloc(sz); |
| 194 | 196 | |
| 195 | - if(ptr) | |
| 196 | - memset(ptr,0,sz); | |
| 197 | + if(!ptr) | |
| 198 | + perror("calloc"); | |
| 197 | 199 | |
| 200 | + memset(ptr,0,sz); | |
| 198 | 201 | return ptr; |
| 199 | 202 | } |
| 200 | 203 | ... | ... |