Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

leak fix #2455

Closed
wzdev-ci opened this issue Jan 20, 2011 · 4 comments
Closed

leak fix #2455

wzdev-ci opened this issue Jan 20, 2011 · 4 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_bug | by antomL@...


dudes, you have multiple memory leaks in the code.
here is a fix for one of them.

diff --git a/lib/framework/configfile.cpp b/lib/framework/configfile.cpp
index 8c31783..e392903 100644
--- a/lib/framework/configfile.cpp
+++ b/lib/framework/configfile.cpp
@@ -231,6 +231,7 @@ static bool registry_save(const char* filename)
 	size_t w = 0;
 	size_t bufferSize = 0;
 	unsigned int i;
+	bool val;
 
 	debug(LOG_WZ, "Saving the registry to [directory: %s] %s", PHYSFS_getRealDir(filename), filename);
 	for (i = 0; i < ARRAY_SIZE(registry); ++i)
@@ -262,8 +263,9 @@ static bool registry_save(const char* filename)
 			free(value);
 		}
 	}
-
-	return saveFile(filename, buffer, w);
+	val = saveFile(filename, buffer, w);
+	free(buffer);
+	return val;
 }
 
 void setRegistryFilePath(const char* fileName)

dudes, CAN YOU PLEASE REVERT #2444? It causes 353 more warnings and is not needed.


Issue migrated from trac:2455 at 2022-04-16 07:46:23 -0700

@wzdev-ci
Copy link
Contributor Author

Cyp changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Cyp changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

Cyp commented


Fix memory leak when saving config.

Fixes #2455.
Changeset: 3d5f96f19911d0d77f013f1e449fe1587e18d91d

@wzdev-ci
Copy link
Contributor Author

Cyp commented


Fix memory leak when saving config.

Fixes #2455.
Changeset: 3d5f96f19911d0d77f013f1e449fe1587e18d91d

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant