platform: msm_shared: Fix memory leak

Scatter gather list is allocated on heap, free the scatter gather list
before returning the command failure.

CRs-Fixed: 677061
Change-Id: Ic19fcffc25127d074716deb785bd98ef176e184a
diff --git a/platform/msm_shared/sdhci.c b/platform/msm_shared/sdhci.c
index a9bb1a4..ebaf942 100644
--- a/platform/msm_shared/sdhci.c
+++ b/platform/msm_shared/sdhci.c
@@ -728,6 +728,7 @@
  */
 uint32_t sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 {
+	uint32_t ret = 0;
 	uint8_t retry = 0;
 	uint32_t resp_type = 0;
 	uint16_t trans_mode = 0;
@@ -864,20 +865,23 @@
 
 	/* Command complete sequence */
 	if (sdhci_cmd_complete(host, cmd))
-		return 1;
+	{
+		ret = 1;
+		goto err;
+	}
 
 	/* Invalidate the cache only for read operations */
 	if (cmd->trans_mode == SDHCI_MMC_READ)
 		arch_invalidate_cache_range((addr_t)cmd->data.data_ptr, (cmd->data.num_blocks * SDHCI_MMC_BLK_SZ));
 
+	DBG("\n %s: END: cmd:%04d, arg:0x%08x, resp:0x%08x 0x%08x 0x%08x 0x%08x\n",
+				__func__, cmd->cmd_index, cmd->argument, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
+err:
 	/* Free the scatter/gather list */
 	if (sg_list)
 		free(sg_list);
 
-	DBG("\n %s: END: cmd:%04d, arg:0x%08x, resp:0x%08x 0x%08x 0x%08x 0x%08x\n",
-				__func__, cmd->cmd_index, cmd->argument, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
-
-	return 0;
+	return ret;
 }
 
 /*