From 746649ae774451ad28adfebe7be0ef4d9435243b Mon Sep 17 00:00:00 2001 From: Emanuele Giaquinta Date: Sun, 24 Sep 2006 21:43:12 +0000 Subject: [PATCH] In line_split set *output _after_ calling remove_newline because it could reallocate rec->str, fixes bug #439. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4381 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/line-split.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/line-split.c b/src/core/line-split.c index b7daf275..a1e96544 100644 --- a/src/core/line-split.c +++ b/src/core/line-split.c @@ -90,6 +90,7 @@ static int remove_newline(LINEBUF_REC *rec) int line_split(const char *data, int len, char **output, LINEBUF_REC **buffer) { LINEBUF_REC *rec; + int ret; g_return_val_if_fail(data != NULL, -1); g_return_val_if_fail(output != NULL, -1); @@ -122,8 +123,9 @@ int line_split(const char *data, int len, char **output, LINEBUF_REC **buffer) } } + ret = remove_newline(rec); *output = rec->str; - return remove_newline(rec); + return ret; } void line_split_free(LINEBUF_REC *buffer)