Fixed this issue by using $wp_query->get_queried_object(); as the following in my code:
/**
* Add sub menu item to admin bar
*/
function custom_admin_bar_render() {
global $wp_admin_bar;
global $wp_query;
$post_obj = $wp_query->get_queried_object();
$post_id = $post_obj->ID;
if ( is_single() )
$wp_admin_bar->add_menu( array(
'id' => 'edit',
//here define the name of parent under which this link is required to appear
'parent' => 'new-content',
'title' => __( 'Edit'),
'href' => get_edit_post_link($post_id)
) );
}
Hope this will help someone.