Set custom field during Membership signup through a Contribution Page
Please check the PR: https://github.com/civicrm/civicrm-core/pull/8052

The bug mentioned in description is not replicating, but found an additional bug. After making online membership contribution, with custom field included in profile, custom data is not getting saved in fields. When, view a membership record on contact summary page.

So made additional fix for CRM-18282.