# HG changeset patch # User Daniel Atallah # Date 1191962449 0 # Node ID 49fcee9835aa3122fe2eafdabe24bf3286486c2b # Parent 296aaf148aed019a6c3c63cf59f5fa9dd13051af Fix CID 317 and 335 as well as an additional leak. diff -r 296aaf148aed -r 49fcee9835aa libpurple/plugins/log_reader.c --- a/libpurple/plugins/log_reader.c Tue Oct 09 20:12:48 2007 +0000 +++ b/libpurple/plugins/log_reader.c Tue Oct 09 20:40:49 2007 +0000 @@ -1939,13 +1939,11 @@ g_return_val_if_fail(data->path != NULL, g_strdup("")); g_return_val_if_fail(data->length > 0, g_strdup("")); - error = NULL; - - contents = g_malloc(data->length + 2); - file = g_fopen(data->path, "rb"); g_return_val_if_fail(file != NULL, g_strdup("")); - + + contents = g_malloc(data->length + 2); + fseek(file, data->offset, SEEK_SET); fread(contents, data->length, 1, file); fclose(file); @@ -2026,7 +2024,7 @@ g_string_append(formatted, " "); if (is_in_message) { - if (buddy_name != NULL && buddy->alias) { + if (buddy_name != NULL && buddy != NULL && buddy->alias) { g_string_append_printf(formatted, "" "%s: ", buddy->alias); @@ -2056,7 +2054,9 @@ g_string_append(formatted, line); g_string_append(formatted, "
"); } - line = ++c; + + if (c) + line = ++c; } } g_free(contents);