[PATCH] Fix memory leaks on error path
Tim Potter
tpot at samba.org
Mon Feb 18 10:00:51 GMT 2008
---
source/libsmb/clifile.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/source/libsmb/clifile.c b/source/libsmb/clifile.c
index 9b4c380..10c35a3 100644
--- a/source/libsmb/clifile.c
+++ b/source/libsmb/clifile.c
@@ -38,8 +38,15 @@ static bool cli_link_internal(struct cli_state *cli, const char *oldname, const
size_t newlen = 2*(strlen(newname)+1);
param = SMB_MALLOC_ARRAY(char, 6+newlen+2);
+
+ if (!param) {
+ return false;
+ }
+
data = SMB_MALLOC_ARRAY(char, oldlen+2);
- if (!param || !data) {
+
+ if (!data) {
+ SAFE_FREE(param);
return false;
}
--
1.5.2.5
More information about the samba-technical
mailing list