diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/util.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index a8e2bcb7f5..55bb3647fc 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1757,7 +1757,6 @@ int smb_mkstemp(char *template) /** malloc that aborts with smb_panic on fail or zero size. **/ - void *smb_xmalloc(size_t size) { void *p; @@ -1771,7 +1770,6 @@ void *smb_xmalloc(size_t size) /** Memdup with smb_panic on fail. **/ - void *smb_xmemdup(const void *p, size_t size) { void *p2; @@ -1783,7 +1781,6 @@ void *smb_xmemdup(const void *p, size_t size) /** strdup that aborts on malloc fail. **/ - char *smb_xstrdup(const char *s) { char *s1 = strdup(s); @@ -1792,6 +1789,19 @@ char *smb_xstrdup(const char *s) return s1; } +/* + vasprintf that aborts on malloc fail +*/ +int smb_xvasprintf(char **ptr, const char *format, va_list ap) +{ + int n; + n = vasprintf(ptr, format, ap); + if (n == -1 || ! *ptr) { + smb_panic("smb_xvasprintf: out of memory"); + } + return n; +} + /***************************************************************** like strdup but for memory *****************************************************************/ |