Fix buffersize may smaller than the input files

Buffter size depends on the first input file.
If the second file is larger than the first one,
the buffer size is not enough.

Allocate and free buffer everytime when read a new file.

Bug: 109664165
Bug: 110117072
Test: Not yet.
Change-Id: Ie962d742972245da9f0075d1b018257fd58d321d
diff --git a/ls_client/src/LsClient.cpp b/ls_client/src/LsClient.cpp
index 75a7258..25b7c00 100755
--- a/ls_client/src/LsClient.cpp
+++ b/ls_client/src/LsClient.cpp
@@ -158,6 +158,8 @@
     /*Get 20bye SHA1 of the script*/
     lsHashInfo.lsScriptHash =
         getHASH(lsHashInfo.lsRawScriptBuf, (size_t)lsBufSize);
+    phNxpEse_free(lsHashInfo.lsRawScriptBuf);
+    lsHashInfo.lsRawScriptBuf = nullptr;
     if (lsHashInfo.lsScriptHash == nullptr) break;
 
     if (lsHashInfo.readBuffHash == nullptr) {
@@ -218,7 +220,6 @@
     }
   } while (++index <= LS_MAX_COUNT);
 
-  phNxpEse_free(lsHashInfo.lsRawScriptBuf);
   phNxpEse_free(lsHashInfo.readBuffHash);
 
   if (status == LSCSTATUS_SUCCESS) {