Changeset 99f929c


Ignore:
Timestamp:
2008-04-21T21:53:15Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
23c4e64
Parents:
aefaac3a
Message:

Now checking if msn_sb_create() returns NULL. This is very unlikely, but
can happen if we run out of file descriptors, for example.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/ns.c

    raefaac3a r99f929c  
    178178                       
    179179                        debug( "Connecting to a new switchboard with key %s", cmd[5] );
    180                         sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW );
     180
     181                        if( ( sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ) ) == NULL )
     182                        {
     183                                /* Although this isn't strictly fatal for the NS connection, it's
     184                                   definitely something serious (we ran out of file descriptors?). */
     185                                imcb_error( ic, "Could not create new switchboard" );
     186                                imc_logout( ic, TRUE );
     187                                return( 0 );
     188                        }
    181189                       
    182190                        if( md->msgq )
     
    468476                debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] );
    469477               
    470                 sb = msn_sb_create( ic, server, port, cmd[4], session );
    471                 sb->who = g_strdup( cmd[5] );
     478                if( ( sb = msn_sb_create( ic, server, port, cmd[4], session ) ) == NULL )
     479                {
     480                        /* Although this isn't strictly fatal for the NS connection, it's
     481                           definitely something serious (we ran out of file descriptors?). */
     482                        imcb_error( ic, "Could not create new switchboard" );
     483                        imc_logout( ic, TRUE );
     484                        return( 0 );
     485                }
     486                else
     487                {
     488                        sb->who = g_strdup( cmd[5] );
     489                }
    472490        }
    473491        else if( strcmp( cmd[0], "ADD" ) == 0 )
Note: See TracChangeset for help on using the changeset viewer.