Michael Stefaniuc : hhctrl.ocx: Fix the mem handling in get_attr() (Smatch) .
Alexandre Julliard
julliard at winehq.org
Wed Jan 27 12:27:22 CST 2010
Module: wine
Branch: master
Commit: 85afcdbfb3d1cae949c622098ff0d84b33500319
URL: http://source.winehq.org/git/wine.git/?a=commit;h=85afcdbfb3d1cae949c622098ff0d84b33500319
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Tue Jan 26 22:13:54 2010 +0100
hhctrl.ocx: Fix the mem handling in get_attr() (Smatch).
name_buf is allocated on the stack and node_buf by heap_alloc.
Also don't leak node_buf when leaving the function.
---
dlls/hhctrl.ocx/content.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/hhctrl.ocx/content.c b/dlls/hhctrl.ocx/content.c
index 39be04b..10de54c 100644
--- a/dlls/hhctrl.ocx/content.c
+++ b/dlls/hhctrl.ocx/content.c
@@ -186,7 +186,7 @@ static const char *get_attr(const char *node, const char *name, int *len)
ptr = strstr(node_buf, name_buf);
if(!ptr) {
WARN("name not found\n");
- heap_free(name_buf);
+ heap_free(node_buf);
return NULL;
}
@@ -194,14 +194,16 @@ static const char *get_attr(const char *node, const char *name, int *len)
ptr2 = strchr(ptr, '\"');
if(!ptr2)
{
- heap_free(name_buf);
+ heap_free(node_buf);
return NULL;
}
*len = ptr2-ptr;
- heap_free(name_buf);
/* Return the pointer offset within the original string */
- return node+(ptr-node_buf);
+ ptr = node+(ptr-node_buf);
+
+ heap_free(node_buf);
+ return ptr;
}
static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const char *text)
More information about the wine-cvs
mailing list