]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/TianoCompress/TianoCompress.c
BaseTools/TianoCompress: Fix potential memory leak
[mirror_edk2.git] / BaseTools / Source / C / TianoCompress / TianoCompress.c
index 93cb6c3ac31427f1de6e6f4c4c3c32618f708f76..44dbccf9ad2bd046f9e50b4cf946b9dedc3b08b6 100644 (file)
@@ -1906,7 +1906,7 @@ Returns:
     FileBuffer = (UINT8 *) malloc (InputLength);\r
     if (FileBuffer == NULL) {\r
       Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");\r
-      return 1;\r
+      goto ERROR;\r
     }\r
 \r
     Status = GetFileContents (\r
@@ -1917,8 +1917,8 @@ Returns:
   }\r
 \r
   if (EFI_ERROR(Status)) {\r
-    free(FileBuffer);\r
-    return 1;\r
+    Error (NULL, 0, 0004, "Error getting contents of file: %s", InputFileName);\r
+    goto ERROR;\r
   }\r
 \r
   if (OutputFileName == NULL) {\r