summaryrefslogtreecommitdiffstats
path: root/elapi/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-09-17 16:04:45 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-09-21 11:44:51 -0400
commitc8afa2d4bd5ecd6cf5f4dc5d0cbedb9470ce848a (patch)
treea75b3f812038497bcad944f0bc3879272b9e6717 /elapi/providers
parentc5a0363437783d27140bd359ce59f5a92a879d07 (diff)
downloadding-libs2-c8afa2d4bd5ecd6cf5f4dc5d0cbedb9470ce848a.tar.gz
ding-libs2-c8afa2d4bd5ecd6cf5f4dc5d0cbedb9470ce848a.tar.xz
ding-libs2-c8afa2d4bd5ecd6cf5f4dc5d0cbedb9470ce848a.zip
ELAPI: Ticket 161: Initialize structures with calloc instead of enumerating members
Diffstat (limited to 'elapi/providers')
-rw-r--r--elapi/providers/file/file_fmt_csv.c2
-rw-r--r--elapi/providers/file/file_provider.c8
2 files changed, 3 insertions, 7 deletions
diff --git a/elapi/providers/file/file_fmt_csv.c b/elapi/providers/file/file_fmt_csv.c
index a811113..e55d0b1 100644
--- a/elapi/providers/file/file_fmt_csv.c
+++ b/elapi/providers/file/file_fmt_csv.c
@@ -275,7 +275,7 @@ int file_get_csv_cfg(void **storage,
TRACE_FLOW_STRING("file_get_csv_cfg", "Entry");
/* Allocate memory for configuration */
- cfg = (struct file_csv_cfg *)malloc(sizeof(struct file_csv_cfg));
+ cfg = (struct file_csv_cfg *) calloc(1, sizeof(struct file_csv_cfg));
if (cfg == NULL) {
TRACE_ERROR_NUMBER("Failed to allocate storage for CSV configuration", ENOMEM);
return ENOMEM;
diff --git a/elapi/providers/file/file_provider.c b/elapi/providers/file/file_provider.c
index 09d6261..652e646 100644
--- a/elapi/providers/file/file_provider.c
+++ b/elapi/providers/file/file_provider.c
@@ -550,16 +550,12 @@ static int file_create_ctx(struct file_prvdr_ctx **file_ctx,
TRACE_FLOW_STRING("file_create_ctx", "Entry point");
- ctx = (struct file_prvdr_ctx *)malloc(sizeof(struct file_prvdr_ctx));
+ ctx = (struct file_prvdr_ctx *)calloc(1, sizeof(struct file_prvdr_ctx));
if (ctx == NULL) {
TRACE_ERROR_NUMBER("Failed to allocate context", ENOMEM);
return ENOMEM;
}
-
- /* Init allocatable items */
- ctx->config.filename = NULL;
- ctx->config.main_fmt_cfg = NULL;
- ctx->config.lo_fmt_cfg = NULL;
+ /* Init items */
ctx->outfile = -1;
/* Read configuration data */