diff options
author | VMiklos <vmiklos@frugalware.org> | 2007-08-21 00:37:17 +0200 |
---|---|---|
committer | VMiklos <vmiklos@frugalware.org> | 2007-08-21 00:37:17 +0200 |
commit | 98bca363574144c9e488812c61249613fcb5e989 (patch) | |
tree | 64e435ecee63e18e03b9f003d4996cf29cf39816 | |
parent | 23411c64ecb0608a2629083504c8e59458c7e0fa (diff) |
prevent a segfault in skype_read_callback()
-rw-r--r-- | skype/skype.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/skype/skype.c b/skype/skype.c index 2086c192..51c95913 100644 --- a/skype/skype.c +++ b/skype/skype.c @@ -72,7 +72,7 @@ static gboolean skype_read_callback( gpointer data, gint fd, b_input_condition c int st; char **lines, **lineptr, *line, *ptr; - if( sd->fd == -1 ) + if( !sd || sd->fd == -1 ) return FALSE; st = read( sd->fd, buf, sizeof( buf ) ); if( st > 0 ) @@ -236,8 +236,15 @@ static void skype_login( account_t *acc ) static void skype_logout( struct im_connection *ic ) { struct skype_data *sd = ic->proto_data; + char *buf; + + buf = g_strdup_printf("SET USERSTATUS OFFLINE\n"); + skype_write( ic, buf, strlen( buf ) ); + g_free(buf); + g_free(sd->username); g_free(sd); + ic->proto_data = NULL; } static int skype_buddy_msg( struct im_connection *ic, char *who, char *message, int flags ) |