From 9bff9896a6060cdc6c74a31e32577855f1a7ddb6 Mon Sep 17 00:00:00 2001 From: Marco Graf Date: Fri, 12 Nov 2010 13:53:20 +0000 Subject: Bug in function 'memdebug_cleanup' corrected (access just freed struct) git-svn-id: https://parma.zhaw.ch/svn/csnippets@6 bb4c1ae6-6eb5-4d93-a66e-2307d6765a9c --- memdebug/memdebug.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/memdebug/memdebug.c b/memdebug/memdebug.c index 887ca42..b0af5b1 100644 --- a/memdebug/memdebug.c +++ b/memdebug/memdebug.c @@ -7,6 +7,10 @@ * Copyright (c) 2010 Zurich University of Applied Sciences * Copyright (c) 2010 Tobias Klauser * + * HISTORY + * 12.11.2010 gram Bug in function 'memdebug_cleanup' corrected (access + * just freed struct) + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights @@ -44,11 +48,12 @@ void memdebug_start(void) void memdebug_cleanup(void) { - struct memdebug_heap_item *hi; + struct memdebug_heap_item *hi, *next; - for (hi = heap_head; hi; hi = hi->next) { + for (hi = heap_head; hi; hi = next) { if (hi->addr) free(hi->addr); + next = hi->next; free(hi); } -- cgit v1.2.3-54-g00ecf