changeset 18795:883c18d31bf4

Fix more null pointer derefs in the log reader plugin. Fixes #2378.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 03 Aug 2007 13:29:02 +0000
parents 2cb148647f8f
children 95fe5195bf98
files libpurple/plugins/log_reader.c
diffstat 1 files changed, 25 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/log_reader.c	Fri Aug 03 13:28:23 2007 +0000
+++ b/libpurple/plugins/log_reader.c	Fri Aug 03 13:29:02 2007 +0000
@@ -60,14 +60,14 @@
 	char *path;
 	GDir *dir;
 
-	g_return_val_if_fail(sn != NULL, list);
-	g_return_val_if_fail(account != NULL, list);
+	g_return_val_if_fail(sn != NULL, NULL);
+	g_return_val_if_fail(account != NULL, NULL);
 
 	logdir = purple_prefs_get_string("/plugins/core/log_reader/adium/log_directory");
 
 	/* By clearing the log directory path, this logger can be (effectively) disabled. */
-	if (!*logdir)
-		return list;
+	if (!logdir || !*logdir)
+		return NULL;
 
 	plugin = purple_find_prpl(purple_account_get_protocol_id(account));
 	if (!plugin)
@@ -236,8 +236,8 @@
 
 	/* XXX: TODO: We probably want to set PURPLE_LOG_READ_NO_NEWLINE
 	 * XXX: TODO: for HTML logs. */
-	if (flags != NULL)
-		*flags = 0;
+	if (flags != NULL)
+		*flags = 0;
 
 	g_return_val_if_fail(log != NULL, g_strdup(""));
 
@@ -626,17 +626,17 @@
 	const char *old_session_id = "";
 	struct msn_logger_data *data = NULL;
 
-	g_return_val_if_fail(sn != NULL, list);
-	g_return_val_if_fail(account != NULL, list);
+	g_return_val_if_fail(sn != NULL, NULL);
+	g_return_val_if_fail(account != NULL, NULL);
 
 	if (strcmp(account->protocol_id, "prpl-msn"))
-		return list;
+		return NULL;
 
 	logdir = purple_prefs_get_string("/plugins/core/log_reader/msn/log_directory");
 
 	/* By clearing the log directory path, this logger can be (effectively) disabled. */
-	if (!*logdir)
-		return list;
+	if (!logdir || !*logdir)
+		return NULL;
 
 	buddy = purple_find_buddy(account, sn);
 
@@ -1121,7 +1121,7 @@
 		if (name_guessed != NAME_GUESS_UNKNOWN)
 			text = g_string_append(text, "</span>");
 
-		style     = xmlnode_get_attrib(text_node, "Style");
+		style = xmlnode_get_attrib(text_node, "Style");
 
 		tmp = xmlnode_get_data(text_node);
 		if (style && *style) {
@@ -1211,14 +1211,14 @@
 	gchar *line;
 	gchar *c;
 
-	g_return_val_if_fail(sn != NULL, list);
-	g_return_val_if_fail(account != NULL, list);
+	g_return_val_if_fail(sn != NULL, NULL);
+	g_return_val_if_fail(account != NULL, NULL);
 
 	logdir = purple_prefs_get_string("/plugins/core/log_reader/trillian/log_directory");
 
 	/* By clearing the log directory path, this logger can be (effectively) disabled. */
-	if (!*logdir)
-		return list;
+	if (!logdir || !*logdir)
+		return NULL;
 
 	plugin = purple_find_prpl(purple_account_get_protocol_id(account));
 	if (!plugin)
@@ -1429,8 +1429,8 @@
 	char *c;
 	const char *line;
 
-	if (flags != NULL)
-		*flags = PURPLE_LOG_READ_NO_NEWLINE;
+	if (flags != NULL)
+		*flags = PURPLE_LOG_READ_NO_NEWLINE;
 
 	g_return_val_if_fail(log != NULL, g_strdup(""));
 
@@ -1776,18 +1776,18 @@
 	int offset = 0;
 	GError *error;
 
-	g_return_val_if_fail(sn != NULL, list);
-	g_return_val_if_fail(account != NULL, list);
+	g_return_val_if_fail(sn != NULL, NULL);
+	g_return_val_if_fail(account != NULL, NULL);
 
 	/* QIP only supports ICQ. */
 	if (strcmp(account->protocol_id, "prpl-icq"))
-		return list;
+		return NULL;
 
 	logdir = purple_prefs_get_string("/plugins/core/log_reader/qip/log_directory");
 
 	/* By clearing the log directory path, this logger can be (effectively) disabled. */
-	if (!*logdir)
-		return list;
+	if (!logdir || !*logdir)
+		return NULL;
 
 	plugin = purple_find_prpl(purple_account_get_protocol_id(account));
 	if (!plugin)
@@ -1927,8 +1927,8 @@
 	char *utf8_string;
 	FILE *file;
 
-	if (flags != NULL)
-		*flags = PURPLE_LOG_READ_NO_NEWLINE;
+	if (flags != NULL)
+		*flags = PURPLE_LOG_READ_NO_NEWLINE;
 
 	g_return_val_if_fail(log != NULL, g_strdup(""));