Explorar o código

Fixes memory leak in Effect.cpp

seanpaultaylor %!s(int64=13) %!d(string=hai) anos
pai
achega
123454a012
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      gameplay/src/Effect.cpp

+ 1 - 1
gameplay/src/Effect.cpp

@@ -180,13 +180,13 @@ void replaceIncludes(const char* filepath, const char* source, std::string& out)
             if (includedSource == NULL)
             if (includedSource == NULL)
             {
             {
                 GP_ERROR("Compile failed for shader '%s' invalid filepath.", filepathStr.c_str());
                 GP_ERROR("Compile failed for shader '%s' invalid filepath.", filepathStr.c_str());
-                SAFE_DELETE_ARRAY(includedSource);
                 return;
                 return;
             }
             }
             else
             else
             {
             {
                 // Valid file so lets attempt to see if we need to append anything to it too (recurse...)
                 // Valid file so lets attempt to see if we need to append anything to it too (recurse...)
                 replaceIncludes(directoryPath.c_str(), includedSource, out);
                 replaceIncludes(directoryPath.c_str(), includedSource, out);
+                SAFE_DELETE_ARRAY(includedSource);
             }
             }
         }
         }
         else
         else