summaryrefslogtreecommitdiff
path: root/docs/examples/fopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/fopen.c')
-rw-r--r--docs/examples/fopen.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/docs/examples/fopen.c b/docs/examples/fopen.c
index eb27c6ae9..f1706fbe6 100644
--- a/docs/examples/fopen.c
+++ b/docs/examples/fopen.c
@@ -237,12 +237,10 @@ URL_FILE *url_fopen(const char *url, const char *operation)
URL_FILE *file;
(void)operation;
- file = malloc(sizeof(URL_FILE));
+ file = calloc(1, sizeof(URL_FILE));
if(!file)
return NULL;
- memset(file, 0, sizeof(URL_FILE));
-
file->handle.file = fopen(url, operation);
if(file->handle.file)
file->type = CFTYPE_FILE; /* marked as URL */