summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b25a043)
raw | patch | inline | side by side (parent: b25a043)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 1 Apr 2016 16:03:50 +0000 (18:03 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 1 Apr 2016 16:03:50 +0000 (18:03 +0200) |
src/oracle.c | patch | blob | history |
diff --git a/src/oracle.c b/src/oracle.c
index fedefd0930e445ac8f33f314c6124c69da3fd935..3e4653d5d3ca7aaed5f1db85310dd1b6670523e1 100644 (file)
--- a/src/oracle.c
+++ b/src/oracle.c
return (-1);
}
- db = malloc (sizeof (*db));
+ db = calloc (1, sizeof (*db));
if (db == NULL)
{
- ERROR ("oracle plugin: malloc failed.");
+ ERROR ("oracle plugin: calloc failed.");
return (-1);
}
- memset (db, 0, sizeof (*db));
db->name = NULL;
db->host = NULL;
db->connect_id = NULL;
#define ALLOC_OR_FAIL(ptr, ptr_size) \
do { \
size_t alloc_size = (size_t) ((ptr_size)); \
- (ptr) = malloc (alloc_size); \
+ (ptr) = calloc (1, alloc_size); \
if ((ptr) == NULL) { \
FREE_ALL; \
- ERROR ("oracle plugin: o_read_database_query: malloc failed."); \
+ ERROR ("oracle plugin: o_read_database_query: calloc failed."); \
return (-1); \
} \
- memset ((ptr), 0, alloc_size); \
} while (0)
/* Initialize everything to NULL so the above works. */