Floating point: writing a long double matrix has errors with valgrind

Consider the following simple C program, which assigns a long double array, initializes it to 0 and then writes it to disk:

#include 
#include 

In t
main (empty)
{
const size_t n = 100;
long double * data = malloc (n * sizeof (long double));
character file name[] = "test.dat";
size_t i;
FILE * f;

for (i = 0; i <n; ++ i)
data[i] = (double length) 0.0;

f = fopen (file name, "w");
fwrite (data, sizeof (long double), n, f);
fclose (f);

free (data);

returns 0;
}

I compile with

gcc -g -Wall -W -o tmp tmp.c -lm

and there are no warnings, and the program works well. However, when I run it through valgrind, I get the following result:

== 25369 == Syscall write parameters (buf) point to uninitialized byte (s)
== 25369 == in 0x4F4C154: write (write.c: 27)
== 25369 == by 0x4EC71BC: _IO_file_write @@ GLIBC_2.2.5 (fileops.c: 1203)
== 25369 == by 0x4EC8F50: new_do_write (fileops.c: 457)
== 25369 == by 0x4EC8F50: _IO_do_write @@ GLIBC_2.2.5 (fileops.c: 433)
== 25369 == by 0x4EC830F: _IO_file_close_it @@ GLIBC_2.2.5 (fileops.c: 136)
== 25369 == by 0x4EBA386: fclose @@ GLIBC_2.2.5 (iofclose.c: 53)
== 25369 == by 0x108879: main (tmp.c: 18)
== 25369 == The address 0x522d93a is 10 bytes inside a block of size 4,096 assigned
== 25369 == in 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
== 25369 == by 0x4EBA18B: _IO_file_doallocate (filedoalloc.c: 101)
== 25369 == by 0x4ECA378: _IO_doallocbuf (genops.c: 365)
== 25369 == by 0x4EC9497: _IO_file_overflow @@ GLIBC_2.2.5 (fileops.c: 759)
== 25369 == by 0x4EC79EC: _IO_file_xsputn @@ GLIBC_2.2.5 (fileops.c: 1266)
== 25369 == by 0x4EBB976: fwrite (iofwrite.c: 39)
== 25369 == by 0x10886D: main (tmp.c: 17)

I can not see anything wrong with the code. If I change the double long for double, it passes valgrind without errors. Maybe it's a bug in valgrind, but did I want to check here first if someone can detect a problem with the code?

EDIT:
If I change malloc to calloc in the previous code, valgrind passes without errors. This indicates that there are some bytes in the array that are not being initialized in my loop that sets the array to zero. Any suggestions on how to solve the problem? I prefer to use malloc instead of calloc.