summaryrefslogtreecommitdiff
path: root/libgphoto2/gphoto2-context.c
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2014-07-21 20:39:48 +0000
committerMarcus Meissner <marcus@jet.franken.de>2014-07-21 20:39:48 +0000
commit0f3f6485c8244000428c928fa0055e52e03c62f7 (patch)
tree6d94d5338e0b80b221c91b2dc1ea3247d008e9de /libgphoto2/gphoto2-context.c
parent9cf5eebe233f882ba1889b28fc975087c5eb4934 (diff)
downloadlibgphoto2-0f3f6485c8244000428c928fa0055e52e03c62f7.tar.gz
From: Axel Waggershauser <awagger@web.de>
here is a patch for (mostly) consistent usage of a generalized C_MEM macro for checking the return values of memory allocating functions, i.e. malloc, calloc, realloc and strdup. It is the C_MEM from libusb1.c, moved to gphoto2-port-log.h. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15096 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2/gphoto2-context.c')
-rw-r--r--libgphoto2/gphoto2-context.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libgphoto2/gphoto2-context.c b/libgphoto2/gphoto2-context.c
index 8ed378884..7086bdc61 100644
--- a/libgphoto2/gphoto2-context.c
+++ b/libgphoto2/gphoto2-context.c
@@ -75,10 +75,9 @@ gp_context_new (void)
{
GPContext *context;
- context = malloc (sizeof (GPContext));
+ context = calloc (1, sizeof (GPContext));
if (!context)
return (NULL);
- memset (context, 0, sizeof (GPContext));
context->ref_count = 1;