[Pidgin] #1092: MSNP14 branch - gmem allocation failure while connecting

Pidgin trac at pidgin.im
Sat May 19 02:59:53 EDT 2007


#1092: MSNP14 branch - gmem allocation failure while connecting
------------------------+---------------------------------------------------
  Reporter:  Pse        |       Owner:  khc                                       
      Type:  patch      |      Status:  new                                       
  Priority:  minor      |   Milestone:  Merge MSNP14 Branch                       
 Component:  libpurple  |     Version:  2.0                                       
Resolution:             |    Keywords:  msnp14 segmentation fault SOAP redirection
   Pending:  0          |  
------------------------+---------------------------------------------------
Comment (by Pse):

 Replying to [comment:2 khc]:
 > Can you fix the patch so it doesn't use magic constants? Like:
 >
 > {{{
 > location += 17; /* Omit the tag preceding the URL */
 > ...
 > location += 3; /* Skip http:// or https:// */
 > }}}
 >
 > also,
 >
 > {{
 > if ( (c = strstr(location, "/")) != NULL ) {
 > ...
 > soapconn->login_path = g_strdup(c);
 > }}
 >
 > and then you free soapconn->login_path right after.

 I've modified the patch to avoid magic constants. Regarding freeing
 soapconn->login_path, I think you're mistaking it with
 soapconn->login_host, which is in fact freed right after
 soapconn->login_path is assigned. The actual sequence is:[[BR]]
 1. g_free(soapconn->login_'''path''')[[BR]]
 2. assign soapconn->login_'''path'''[[BR]]
 3. g_free(soapconn->login_'''host''')[[BR]]
 4. assign soapconn->login_'''host'''[[BR]]
 Note both members are being freed before assigning a value to them, and
 not the other way around.

 It's worth mentioning that this piece of code is pretty much the same as
 the code right above (line 268), so perhaps they could be merged. However,
 I think keeping it this way makes it more readable, and there's not that
 much duplicated code anyway.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/1092#comment:3>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list