summaryrefslogtreecommitdiff
path: root/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp')
-rw-r--r--thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp b/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp
index c3d281482a..05db65cb23 100644
--- a/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp
+++ b/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2021 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -93,7 +93,10 @@ bool PngLoader::read()
png_image_free(image);
return false;
}
- if (!png_image_finish_read(image, NULL, buffer, 0, NULL)) return false;
+ if (!png_image_finish_read(image, NULL, buffer, 0, NULL)) {
+ free(buffer);
+ return false;
+ }
content = reinterpret_cast<uint32_t*>(buffer);
_premultiply(reinterpret_cast<uint32_t*>(buffer), image->width, image->height);