When I free the malloced memory which are not allocated using malloc than valgraind tool gives me error like:
Invalid free() / delete / delete[]
Is it dangerous in embedded C programming?
In code whenever malloc fails than i cannot judge which malloced pointer i have to release.
This will lead to undefined behavior, most likely heap corruption and/or crashing your program. It’s dangerous in any kind of system.