Yes, your program is fine. (Although always rounding up the number of megabytes up is a bit unconventional.)
free, , , . , , . , - . , , , . , size_t , , , .
malloc ( 4K). - , size_t. , , 1% , 1% .
, malloc . 1 , 3056 . 4 , , 3056 * 4k 12 . ( , 12 mebibytes, , mebi.) , 3068 .
½ , 3045 * 2 - 1 ( , ). 6089 , 23,8 3044,5 , 3068,3 .
, malloc , , , .