summaryrefslogtreecommitdiffstats
path: root/src/guestfs.h
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-07-02 15:39:08 +0200
committerJim Meyering <meyering@redhat.com>2009-07-03 00:14:52 +0200
commit447dae7df43e8a98da59d94f1aef9895e087aa13 (patch)
treeae5285a58c6297b5f2c90fc0758da9983073fe4b /src/guestfs.h
parentd0bdef850e7bf0edc1a8ee1f05880cdf867aeeb6 (diff)
downloadlibguestfs-447dae7df43e8a98da59d94f1aef9895e087aa13.tar.gz
libguestfs-447dae7df43e8a98da59d94f1aef9895e087aa13.tar.xz
libguestfs-447dae7df43e8a98da59d94f1aef9895e087aa13.zip
use safe_malloc and safe_calloc in generated code
* src/generator.ml (safe_malloc): Define to guestfs_safe_malloc. (safe_calloc): Define to guestfs_safe_calloc. [most generated code]: Fail immediately upon failure of otherwise- unchecked malloc and calloc calls. * src/guestfs.c: Include <stddef.h>. (xalloc_oversized): Define. * src/guestfs.h (guestfs_safe_calloc): Declare.
Diffstat (limited to 'src/guestfs.h')
-rw-r--r--src/guestfs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/guestfs.h b/src/guestfs.h
index 201d60ca..264986f9 100644
--- a/src/guestfs.h
+++ b/src/guestfs.h
@@ -1,5 +1,5 @@
/* libguestfs
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -77,6 +77,7 @@ extern void guestfs_error (guestfs_h *g, const char *fs, ...)
extern void guestfs_perrorf (guestfs_h *g, const char *fs, ...)
__attribute__((format (printf,2,3)));
extern void *guestfs_safe_malloc (guestfs_h *g, size_t nbytes);
+extern void *guestfs_safe_calloc (guestfs_h *g, size_t n, size_t s);
extern void *guestfs_safe_realloc (guestfs_h *g, void *ptr, int nbytes);
extern char *guestfs_safe_strdup (guestfs_h *g, const char *str);
extern void *guestfs_safe_memdup (guestfs_h *g, void *ptr, size_t size);