[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (bdf06d189aa089b01e13753c3164d35c1aaa8d5e)
The branch, master has been updated
via bdf06d189aa089b01e13753c3164d35c1aaa8d5e (commit)
from 466b0183758ef3ca44623c43de60a233b175d2ad (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/buffer.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
=================
Commit Messages
=================
commit bdf06d189aa089b01e13753c3164d35c1aaa8d5e
Author: Stephen Ecob <silicon.on.inspiration@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
Fix SmashBufferElement(), broken by fixing a memory leak in FreeDataMemory()
Commit 466b0183758ef3ca44623c43de60a233b175d2ad broke SmashBufferElement()
by changing FreeDataMemory() (which SmashBufferElement() calls via
ClearBuffer()). SmashBufferElement() depended on the memory leak of
Data->Element in FreeDataMemory().
This patch removes the dependence on the leak.
Commit-message-reformatted-by: Peter Clifton <pcjc2@xxxxxxxxx>
:100644 100644 1b2d27c... bec918f... M src/buffer.c
=========
Changes
=========
commit bdf06d189aa089b01e13753c3164d35c1aaa8d5e
Author: Stephen Ecob <silicon.on.inspiration@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
Fix SmashBufferElement(), broken by fixing a memory leak in FreeDataMemory()
Commit 466b0183758ef3ca44623c43de60a233b175d2ad broke SmashBufferElement()
by changing FreeDataMemory() (which SmashBufferElement() calls via
ClearBuffer()). SmashBufferElement() depended on the memory leak of
Data->Element in FreeDataMemory().
This patch removes the dependence on the leak.
Commit-message-reformatted-by: Peter Clifton <pcjc2@xxxxxxxxx>
diff --git a/src/buffer.c b/src/buffer.c
index 1b2d27c..bec918f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -933,7 +933,17 @@ SmashBufferElement (BufferTypePtr Buffer)
Message (_("Error! Buffer doesn't contain a single element\n"));
return (false);
}
+ /*
+ * At this point the buffer should contain just a single element.
+ * Now we detach the single element from the buffer and then clear the
+ * buffer, ready to receive the smashed elements. As a result of detaching
+ * it the single element is orphaned from the buffer and thus will not be
+ * free()'d by FreeDataMemory (called via ClearBuffer). This leaves it
+ * around for us to smash bits off it. It then becomes our responsibility,
+ * however, to free the single element when we're finished with it.
+ */
element = &Buffer->Data->Element[0];
+ Buffer->Data->Element = NULL;
Buffer->Data->ElementN = 0;
ClearBuffer (Buffer);
ELEMENTLINE_LOOP (element);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs