summaryrefslogtreecommitdiff
path: root/src/fe-text/textbuffer.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-12-30 23:10:57 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-12-30 23:10:57 +0000
commitf3d43d9137b0d1f126e701b2da5d9ddd37073709 (patch)
tree8a7e4f4f73f49351c32ef44899fd01da7ba7f665 /src/fe-text/textbuffer.c
parent0d7f682cbe01c6a3172062cdf5bc85385e43ed48 (diff)
downloadirssi-f3d43d9137b0d1f126e701b2da5d9ddd37073709.zip
Don't access free'd memory.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3087 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/textbuffer.c')
-rw-r--r--src/fe-text/textbuffer.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c
index 5a8d256d..930e55ad 100644
--- a/src/fe-text/textbuffer.c
+++ b/src/fe-text/textbuffer.c
@@ -113,15 +113,16 @@ static void text_chunk_line_free(TEXT_BUFFER_REC *buffer, LINE_REC *line)
{
TEXT_CHUNK_REC *chunk;
const unsigned char *text;
- unsigned char *tmp = NULL;
+ unsigned char cmd, *tmp = NULL;
for (text = line->text;; text++) {
if (*text != '\0')
continue;
text++;
- if (*text == LINE_CMD_CONTINUE || *text == LINE_CMD_EOL) {
- if (*text == LINE_CMD_CONTINUE)
+ cmd = *text;
+ if (cmd == LINE_CMD_CONTINUE || cmd == LINE_CMD_EOL) {
+ if (cmd == LINE_CMD_CONTINUE)
memcpy(&tmp, text+1, sizeof(char *));
/* free the previous block */
@@ -133,11 +134,11 @@ static void text_chunk_line_free(TEXT_BUFFER_REC *buffer, LINE_REC *line)
text_chunk_destroy(buffer, chunk);
}
- if (*text == LINE_CMD_EOL)
+ if (cmd == LINE_CMD_EOL)
break;
text = tmp-1;
- } else if (*text == LINE_CMD_INDENT_FUNC) {
+ } else if (cmd == LINE_CMD_INDENT_FUNC) {
text += sizeof(int (*) ());
}
}