public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues
@ 2018-04-10  7:54 Dandan Bi
  2018-04-10  7:54 ` [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[] Dandan Bi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dandan Bi @ 2018-04-10  7:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong, Liming Gao

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 BaseTools/Source/C/VfrCompile/VfrSyntax.g | 32 ++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index d48072a8adf..4b0a43606ea 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -4103,10 +4103,11 @@ vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
                                                               }
                                                             }
                                                           }
                                                           
                                                           if ($RootLevel == 0) {
+                                                            _CLEAR_SAVED_OPHDR ();
                                                             mCIfrOpHdrIndex --;
                                                           }
                                                        >>
   ;
 
@@ -4387,10 +4388,16 @@ vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
       ">"
       V5:Number                                        << ConstVal = _STOU16(V5->getText(), V5->getLine()); >>
                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
     )
   )
+  <<
+     if (VarIdStr != NULL) {
+       delete[] VarIdStr;
+       VarIdStr = NULL;
+     }
+  >>
   ;
 
 ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
   <<
      EFI_QUESTION_ID QId;
@@ -4440,10 +4447,16 @@ ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
       ">"
       V5:Number                                        << ConstVal = _STOU16(V5->getText(), V5->getLine()); >>
                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
     )
   )
+  <<
+     if (VarIdStr != NULL) {
+       delete[] VarIdStr;
+       VarIdStr = NULL;
+     }
+  >>
   ;
 
 ideqidExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   <<
      EFI_QUESTION_ID QId[2];
@@ -4492,10 +4505,20 @@ ideqidExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
       ">"
       vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
                                                        << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_THAN); >>
     )
   )
+  <<
+     if (VarIdStr[0] != NULL) {
+       delete[] VarIdStr[0];
+       VarIdStr[0] = NULL;
+     }
+     if (VarIdStr[1] != NULL) {
+       delete[] VarIdStr[1];
+       VarIdStr[1] = NULL;
+     }
+  >>
   ;
 
 ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   <<
      UINT16          ListLen = 0;
@@ -4531,10 +4554,14 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
                                                             if (QId == EFI_QUESTION_ID_INVALID) {
                                                               EILObj.SetQuestionId (QId, VarIdStr, LineNo);
                                                             }
                                                             $ExpOpCount++;
                                                           }
+                                                          if (VarIdStr != NULL) {
+                                                            delete[] VarIdStr;
+                                                            VarIdStr = NULL;
+                                                          }
                                                         >>
   ;
 
 questionref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   <<
@@ -5055,11 +5082,14 @@ EfiVfrParser::_SAVE_OPHDR_COND (
 VOID
 EfiVfrParser::_CLEAR_SAVED_OPHDR (
   VOID
   )
 {
-  mCIfrOpHdr[mCIfrOpHdrIndex]       = NULL;
+  if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
+    delete mCIfrOpHdr[mCIfrOpHdrIndex];
+    mCIfrOpHdr[mCIfrOpHdrIndex]     = NULL;
+  }
   mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;
 }
 
 BOOLEAN
 EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (
-- 
2.14.3.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[]
  2018-04-10  7:54 [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dandan Bi
@ 2018-04-10  7:54 ` Dandan Bi
  2018-04-17  8:17   ` Dong, Eric
  2018-04-17  8:17 ` [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dong, Eric
  2018-05-08  9:45 ` Gary Lin
  2 siblings, 1 reply; 7+ messages in thread
From: Dandan Bi @ 2018-04-10  7:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong, Liming Gao

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 5cab7bbfa1a..d795ef01bda 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -3038,11 +3038,12 @@ CVfrQuestionDB::RegisterNewDateQuestion (
   pNode[2]->mNext       = mQuestionList;
   mQuestionList         = pNode[0];
 
   for (Index = 0; Index < 3; Index++) {
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 
   gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
   gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
@@ -3055,11 +3056,12 @@ Err:
     if (pNode[Index] != NULL) {
       delete pNode[Index];
     }
 
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr [Index];
+      VarIdStr [Index] = NULL;
     }
   }
 }
 
 VOID
@@ -3214,11 +3216,12 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
   pNode[2]->mNext       = mQuestionList;
   mQuestionList         = pNode[0];
 
   for (Index = 0; Index < 3; Index++) {
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 
   gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
   gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
@@ -3231,11 +3234,12 @@ Err:
     if (pNode[Index] != NULL) {
       delete pNode[Index];
     }
 
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 }
 
 VOID 
-- 
2.14.3.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues
  2018-04-10  7:54 [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dandan Bi
  2018-04-10  7:54 ` [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[] Dandan Bi
@ 2018-04-17  8:17 ` Dong, Eric
  2018-05-08  9:45 ` Gary Lin
  2 siblings, 0 replies; 7+ messages in thread
From: Dong, Eric @ 2018-04-17  8:17 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org; +Cc: Gao, Liming

Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: Bi, Dandan 
Sent: Tuesday, April 10, 2018 3:55 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 BaseTools/Source/C/VfrCompile/VfrSyntax.g | 32 ++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index d48072a8adf..4b0a43606ea 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -4103,10 +4103,11 @@ vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
                                                               }
                                                             }
                                                           }
                                                           
                                                           if ($RootLevel == 0) {
+                                                            
+ _CLEAR_SAVED_OPHDR ();
                                                             mCIfrOpHdrIndex --;
                                                           }
                                                        >>
   ;
 
@@ -4387,10 +4388,16 @@ vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
       ">"
       V5:Number                                        << ConstVal = _STOU16(V5->getText(), V5->getLine()); >>
                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
     )
   )
+  <<
+     if (VarIdStr != NULL) {
+       delete[] VarIdStr;
+       VarIdStr = NULL;
+     }
+  >>
   ;
 
 ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
   <<
      EFI_QUESTION_ID QId;
@@ -4440,10 +4447,16 @@ ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
       ">"
       V5:Number                                        << ConstVal = _STOU16(V5->getText(), V5->getLine()); >>
                                                        << IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
     )
   )
+  <<
+     if (VarIdStr != NULL) {
+       delete[] VarIdStr;
+       VarIdStr = NULL;
+     }
+  >>
   ;
 
 ideqidExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   <<
      EFI_QUESTION_ID QId[2];
@@ -4492,10 +4505,20 @@ ideqidExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
       ">"
       vfrQuestionDataFieldName[QId[1], Mask[1], VarIdStr[1], LineNo[1]]
                                                        << IdEqIdDoSpecial ($ExpOpCount, L->getLine(), QId[0], VarIdStr[0], Mask[0], QId[1], VarIdStr[1], Mask[1], GREATER_THAN); >>
     )
   )
+  <<
+     if (VarIdStr[0] != NULL) {
+       delete[] VarIdStr[0];
+       VarIdStr[0] = NULL;
+     }
+     if (VarIdStr[1] != NULL) {
+       delete[] VarIdStr[1];
+       VarIdStr[1] = NULL;
+     }
+  >>
   ;
 
 ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   <<
      UINT16          ListLen = 0;
@@ -4531,10 +4554,14 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
                                                             if (QId == EFI_QUESTION_ID_INVALID) {
                                                               EILObj.SetQuestionId (QId, VarIdStr, LineNo);
                                                             }
                                                             $ExpOpCount++;
                                                           }
+                                                          if (VarIdStr != NULL) {
+                                                            delete[] VarIdStr;
+                                                            VarIdStr = NULL;
+                                                          }
                                                         >>
   ;
 
 questionref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   <<
@@ -5055,11 +5082,14 @@ EfiVfrParser::_SAVE_OPHDR_COND (  VOID  EfiVfrParser::_CLEAR_SAVED_OPHDR (
   VOID
   )
 {
-  mCIfrOpHdr[mCIfrOpHdrIndex]       = NULL;
+  if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
+    delete mCIfrOpHdr[mCIfrOpHdrIndex];
+    mCIfrOpHdr[mCIfrOpHdrIndex]     = NULL;
+  }
   mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;  }
 
 BOOLEAN
 EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (
--
2.14.3.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[]
  2018-04-10  7:54 ` [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[] Dandan Bi
@ 2018-04-17  8:17   ` Dong, Eric
  0 siblings, 0 replies; 7+ messages in thread
From: Dong, Eric @ 2018-04-17  8:17 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org; +Cc: Gao, Liming

Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: Bi, Dandan 
Sent: Tuesday, April 10, 2018 3:55 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[]

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 5cab7bbfa1a..d795ef01bda 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -3038,11 +3038,12 @@ CVfrQuestionDB::RegisterNewDateQuestion (
   pNode[2]->mNext       = mQuestionList;
   mQuestionList         = pNode[0];
 
   for (Index = 0; Index < 3; Index++) {
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 
   gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
   gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID)); @@ -3055,11 +3056,12 @@ Err:
     if (pNode[Index] != NULL) {
       delete pNode[Index];
     }
 
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr [Index];
+      VarIdStr [Index] = NULL;
     }
   }
 }
 
 VOID
@@ -3214,11 +3216,12 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
   pNode[2]->mNext       = mQuestionList;
   mQuestionList         = pNode[0];
 
   for (Index = 0; Index < 3; Index++) {
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 
   gCFormPkg.DoPendingAssign (VarIdStr[0], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID));
   gCFormPkg.DoPendingAssign (VarIdStr[1], (VOID *)&QuestionId, sizeof(EFI_QUESTION_ID)); @@ -3231,11 +3234,12 @@ Err:
     if (pNode[Index] != NULL) {
       delete pNode[Index];
     }
 
     if (VarIdStr[Index] != NULL) {
-      delete VarIdStr[Index];
+      delete[] VarIdStr[Index];
+      VarIdStr[Index] = NULL;
     }
   }
 }
 
 VOID
--
2.14.3.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues
  2018-04-10  7:54 [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dandan Bi
  2018-04-10  7:54 ` [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[] Dandan Bi
  2018-04-17  8:17 ` [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dong, Eric
@ 2018-05-08  9:45 ` Gary Lin
  2018-05-08 11:50   ` Bi, Dandan
  2 siblings, 1 reply; 7+ messages in thread
From: Gary Lin @ 2018-05-08  9:45 UTC (permalink / raw)
  To: Dandan Bi; +Cc: edk2-devel, Eric Dong, Liming Gao

On Tue, Apr 10, 2018 at 03:54:46PM +0800, Dandan Bi wrote:
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  BaseTools/Source/C/VfrCompile/VfrSyntax.g | 32 ++++++++++++++++++++++++++++++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> index d48072a8adf..4b0a43606ea 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
Hi Dandan,

I encountered a build error with our build service:

[  197s] "VfrCompile" -l -n --string-db /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/OUTPUT/BootMaintenanceManagerUiLibStrDefs.hpk --output-directory /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/DEBUG/. /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/OUTPUT/BootMaintenanceManager.i
[  197s] *** Error in `/home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/BaseTools/Source/C/bin/VfrCompile': free(): invalid pointer: 0xbabababababababa ***

If I reverted the following change, the package can be built again.

> @@ -5055,11 +5082,14 @@ EfiVfrParser::_SAVE_OPHDR_COND (
>  VOID
>  EfiVfrParser::_CLEAR_SAVED_OPHDR (
>    VOID
>    )
>  {
> -  mCIfrOpHdr[mCIfrOpHdrIndex]       = NULL;
> +  if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
> +    delete mCIfrOpHdr[mCIfrOpHdrIndex];
> +    mCIfrOpHdr[mCIfrOpHdrIndex]     = NULL;
> +  }
>    mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;
>  }
>  
>  BOOLEAN
>  EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (

I have no clue now and it happened all the time.

Would you mind to check the code?

Thanks,

Gary Lin


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues
  2018-05-08  9:45 ` Gary Lin
@ 2018-05-08 11:50   ` Bi, Dandan
  2018-05-09  1:48     ` Gary Lin
  0 siblings, 1 reply; 7+ messages in thread
From: Bi, Dandan @ 2018-05-08 11:50 UTC (permalink / raw)
  To: Gary Lin; +Cc: edk2-devel@lists.01.org, Dong, Eric, Gao, Liming

Yes. We have submitted patch to fix it. Sorry for the inconvenience.

Thanks,
Dandan

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Gary Lin
Sent: Tuesday, May 8, 2018 5:46 PM
To: Bi, Dandan <dandan.bi@intel.com>
Cc: edk2-devel@lists.01.org; Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: Re: [edk2] [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues

On Tue, Apr 10, 2018 at 03:54:46PM +0800, Dandan Bi wrote:
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  BaseTools/Source/C/VfrCompile/VfrSyntax.g | 32 
> ++++++++++++++++++++++++++++++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g 
> b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> index d48072a8adf..4b0a43606ea 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
Hi Dandan,

I encountered a build error with our build service:

[  197s] "VfrCompile" -l -n --string-db /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/OUTPUT/BootMaintenanceManagerUiLibStrDefs.hpk --output-directory /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/DEBUG/. /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/OUTPUT/BootMaintenanceManager.i
[  197s] *** Error in `/home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/BaseTools/Source/C/bin/VfrCompile': free(): invalid pointer: 0xbabababababababa ***

If I reverted the following change, the package can be built again.

> @@ -5055,11 +5082,14 @@ EfiVfrParser::_SAVE_OPHDR_COND (  VOID  
> EfiVfrParser::_CLEAR_SAVED_OPHDR (
>    VOID
>    )
>  {
> -  mCIfrOpHdr[mCIfrOpHdrIndex]       = NULL;
> +  if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
> +    delete mCIfrOpHdr[mCIfrOpHdrIndex];
> +    mCIfrOpHdr[mCIfrOpHdrIndex]     = NULL;
> +  }
>    mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;  }
>  
>  BOOLEAN
>  EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (

I have no clue now and it happened all the time.

Would you mind to check the code?

Thanks,

Gary Lin
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues
  2018-05-08 11:50   ` Bi, Dandan
@ 2018-05-09  1:48     ` Gary Lin
  0 siblings, 0 replies; 7+ messages in thread
From: Gary Lin @ 2018-05-09  1:48 UTC (permalink / raw)
  To: Bi, Dandan; +Cc: edk2-devel@lists.01.org, Dong, Eric, Gao, Liming

On Tue, May 08, 2018 at 11:50:46AM +0000, Bi, Dandan wrote:
> Yes. We have submitted patch to fix it. Sorry for the inconvenience.
> 
Awesome! Thanks for the quick response :)

Gary Lin

> Thanks,
> Dandan
> 
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Gary Lin
> Sent: Tuesday, May 8, 2018 5:46 PM
> To: Bi, Dandan <dandan.bi@intel.com>
> Cc: edk2-devel@lists.01.org; Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: Re: [edk2] [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues
> 
> On Tue, Apr 10, 2018 at 03:54:46PM +0800, Dandan Bi wrote:
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> > ---
> >  BaseTools/Source/C/VfrCompile/VfrSyntax.g | 32 
> > ++++++++++++++++++++++++++++++-
> >  1 file changed, 31 insertions(+), 1 deletion(-)
> > 
> > diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g 
> > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > index d48072a8adf..4b0a43606ea 100644
> > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
> Hi Dandan,
> 
> I encountered a build error with our build service:
> 
> [  197s] "VfrCompile" -l -n --string-db /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/OUTPUT/BootMaintenanceManagerUiLibStrDefs.hpk --output-directory /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/DEBUG/. /home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib/OUTPUT/BootMaintenanceManager.i
> [  197s] *** Error in `/home/abuild/rpmbuild/BUILD/ovmf-2018+git1525681922.053cd183c9f2/BaseTools/Source/C/bin/VfrCompile': free(): invalid pointer: 0xbabababababababa ***
> 
> If I reverted the following change, the package can be built again.
> 
> > @@ -5055,11 +5082,14 @@ EfiVfrParser::_SAVE_OPHDR_COND (  VOID  
> > EfiVfrParser::_CLEAR_SAVED_OPHDR (
> >    VOID
> >    )
> >  {
> > -  mCIfrOpHdr[mCIfrOpHdrIndex]       = NULL;
> > +  if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
> > +    delete mCIfrOpHdr[mCIfrOpHdrIndex];
> > +    mCIfrOpHdr[mCIfrOpHdrIndex]     = NULL;
> > +  }
> >    mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;  }
> >  
> >  BOOLEAN
> >  EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (
> 
> I have no clue now and it happened all the time.
> 
> Would you mind to check the code?
> 
> Thanks,
> 
> Gary Lin
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-05-09  1:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-10  7:54 [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dandan Bi
2018-04-10  7:54 ` [patch 2/2] BaseTool/VfrCompile: make delete[] match with new[] Dandan Bi
2018-04-17  8:17   ` Dong, Eric
2018-04-17  8:17 ` [patch 1/2] BaseTools/VfrCompile:Fix memory leak issues Dong, Eric
2018-05-08  9:45 ` Gary Lin
2018-05-08 11:50   ` Bi, Dandan
2018-05-09  1:48     ` Gary Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox