X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/46cfeac8e5e6263f64f03028b98e27c0b09575f9..34826e4ae9c6255d70c702704f5f6c3874b1e3ff:/puttymem.h diff --git a/puttymem.h b/puttymem.h index b529c985..6ef3f794 100644 --- a/puttymem.h +++ b/puttymem.h @@ -14,7 +14,7 @@ #define smalloc(z) (mlog(__FILE__,__LINE__), safemalloc(z,1)) #define snmalloc(z,s) (mlog(__FILE__,__LINE__), safemalloc(z,s)) #define srealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z,1)) -#define snrealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z,s)) +#define snrealloc(y,z,s) (mlog(__FILE__,__LINE__), saferealloc(y,z,s)) #define sfree(z) (mlog(__FILE__,__LINE__), safefree(z)) void mlog(char *, int); #else @@ -37,6 +37,7 @@ void safefree(void *); */ #define snew(type) ((type *)snmalloc(1, sizeof(type))) #define snewn(n, type) ((type *)snmalloc((n), sizeof(type))) -#define sresize(ptr, n, type) ((type *)snrealloc((ptr), (n), sizeof(type))) +#define sresize(ptr, n, type) \ + ((type *)snrealloc((sizeof((type *)0 == (ptr)), (ptr)), (n), sizeof(type))) #endif