changed malloc in add log function
finished task3