mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
out of memory checks: add missing sh_getcwd() wrapper (re: 7ad274f8)
getcwd() with 0/NULL arguments also mallocs, so needs a check.
This commit is contained in:
parent
f6a6d236f1
commit
a3f4b5efd1
3 changed files with 10 additions and 1 deletions
|
|
@ -400,6 +400,7 @@ extern void *sh_realloc(void *ptr, size_t size);
|
|||
extern void *sh_calloc(size_t nmemb, size_t size);
|
||||
extern char *sh_strdup(const char *s);
|
||||
extern void *sh_memdup(const void *s, size_t n);
|
||||
extern char *sh_getcwd(void);
|
||||
#define new_of(type,x) ((type*)sh_malloc((unsigned)sizeof(type)+(x)))
|
||||
#define sh_newof(p,t,n,x) ((p)?(t*)sh_realloc((char*)(p),sizeof(t)*(n)+(x)):(t*)sh_calloc(1,sizeof(t)*(n)+(x)))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue