Error in `./a.out‘: free(): invalid next size (fast): 0x0000000001da8010

Error in `./a.out’: free(): invalid next size (fast): 0x0000000001da8010

*** Error in `./a.out': free(): invalid next size (fast): 0x0000000001da8010 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7f216399b7f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8038a)[0x7f21639a438a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f21639a858c]
./a.out[0x400896]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f2163944840]
./a.out[0x400609]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:01 1155                               /home/csgec/C++/a.out
00600000-00601000 r--p 00000000 08:01 1155                               /home/csgec/C++/a.out
00601000-00602000 rw-p 00001000 08:01 1155                               /home/csgec/C++/a.out
01da8000-01dc9000 rw-p 00000000 00:00 0                                  [heap]
7f215c000000-7f215c021000 rw-p 00000000 00:00 0 
7f215c021000-7f2160000000 ---p 00000000 00:00 0 
7f216370e000-7f2163724000 r-xp 00000000 08:01 923094                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2163724000-7f2163923000 ---p 00016000 08:01 923094                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2163923000-7f2163924000 rw-p 00015000 08:01 923094                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2163924000-7f2163ae4000 r-xp 00000000 08:01 953576                     /lib/x86_64-linux-gnu/libc-2.23.so
7f2163ae4000-7f2163ce4000 ---p 001c0000 08:01 953576                     /lib/x86_64-linux-gnu/libc-2.23.so
7f2163ce4000-7f2163ce8000 r--p 001c0000 08:01 953576                     /lib/x86_64-linux-gnu/libc-2.23.so
7f2163ce8000-7f2163cea000 rw-p 001c4000 08:01 953576                     /lib/x86_64-linux-gnu/libc-2.23.so
7f2163cea000-7f2163cee000 rw-p 00000000 00:00 0 
7f2163cee000-7f2163d14000 r-xp 00000000 08:01 953568                     /lib/x86_64-linux-gnu/ld-2.23.so
7f2163ef7000-7f2163efa000 rw-p 00000000 00:00 0 
7f2163f12000-7f2163f13000 rw-p 00000000 00:00 0 
7f2163f13000-7f2163f14000 r--p 00025000 08:01 953568                     /lib/x86_64-linux-gnu/ld-2.23.so
7f2163f14000-7f2163f15000 rw-p 00026000 08:01 953568                     /lib/x86_64-linux-gnu/ld-2.23.so
7f2163f15000-7f2163f16000 rw-p 00000000 00:00 0 
7ffcd77e9000-7ffcd780a000 rw-p 00000000 00:00 0                          [stack]
7ffcd798b000-7ffcd798e000 r--p 00000000 00:00 0                          [vvar]
7ffcd798e000-7ffcd7990000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
fish: Job 2, “./a.out” terminated by signal SIGABRT (Abort)

resolvent:

unsigned int *a = (unsigned int *)malloc(sizeof(unsigned int) * 2 * n);

Malloc dynamically allocates memory. N must have confirmed the value
① you can add int n = 5 before applying for space

int n = 5;
    unsigned int *a = (unsigned int *)malloc(sizeof(unsigned int) * 2 * n);

⑤ You can also allocate space after user input, so that the value of n is known
unknown dynamic space cannot be allocated before user input.

 scanf("%d %d",&n,&m);
   // getchar();
    unsigned int *a = (unsigned int *)malloc(sizeof(unsigned int) * 2 * n);

After correction, the error report can disappear.

Read More: