Srimad Bhagavatam Canto 03, Chapter 12, Text 34

SB 3.12.34

kadacid dhyayatah srastur
 veda asams catur-mukhat
katham sraksyamy aham lokan
 samavetan yatha pura
 
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
Once upon a time, when Brahma was thinking of how to create the worlds as in the past millennium, the four Vedas, which contain all varieties of knowledge, became manifested from his four mouths.
 
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
As a fire can consume anything and everything without being contaminated, so, by the grace of the Lord, the fire of Brahma’s greatness consumed his desire for the sinful act of sex with his daughter. The Vedas are the source of all knowledge, and they were first revealed to Brahma by the mercy of the Supreme Personality of Godhead while Brahma was thinking of re-creating the material world. Brahma is powerful by dint of his devotional service unto the Lord, and the Lord is always ready to forgive His devotee if by chance he falls down from the noble path of devotional service. The Srimad-Bhagavatam (11.5.42) confirms this as follows:
 
sva-pada-mulam bhajatah priyasya
 tyaktvanya-bhavasya harih paresah
vikarma yac cotpatitam kathañ-cid
 dhunoti sarvam hrdi sannvistah
 
“Any person who is engaged one hundred percent in the transcendental loving service of the Lord, at His lotus feet, is very dear to the Personality of Godhead Hari, and the Lord, being situated in the heart of the devotee, excuses all kinds of sins committed by chance.” It was never expected that a great personality like Brahma would ever think of sex indulgence with his daughter. The example shown by Brahma only suggests that the power of material nature is so strong that it can act upon everyone, even Brahma. Brahma was saved by the mercy of the Lord with a little punishment, but by the grace of the Lord he did not lose his prestige as the great Brahma.
Srimad Bhagavatam Canto 03, Chapter 12, Text 33
Srimad Bhagavatam Canto 03, Chapter 12, Text 35