[PATCH] gFTP bug fix




Hi Brian, gnome-developers,

I think I have fixed an annoying crash bug with gFTP. It is the age old
classic of reading memory which has in fact been free'd, so it only shows
up intermittently.

The following patch cures a reproducible crash case I found. If it isn't
the right fix it will certainly highlight the problem for a proper fix.
I'm not sure if the "data" pointer referenced at the end hasbeen freed
also.

gFTP probably needs a good electric-fencing.

Cheers
Chris

PS. Related yet off-topic. Has anyone got the new "-fcheck-memory-usage"
gcc2.8/egcs1.1.1 flag and/or Checker working? The combination looks like a
_very_ powerful memory checking tool. If anyone has this working dropping
me a note would be appreciated.

--- gftp.c.old	Tue Feb 23 23:19:52 1999
+++ gftp.c	Tue Feb 23 23:20:30 1999
@@ -997,16 +997,19 @@
    wdata = (struct ftp_window_data *) data;
    if(wdata->local == -1 || wdata->numselected != 1) return;
    if(event->type == GDK_2BUTTON_PRESS) {
+      int flagcopy;
+
       if((tempfle = get_next_selected_filename(wdata->host->files)) == NULL) {
          ftp_log(LOG_MISC, "Internal gFTP Error: Could not find a selected file. This is probably a bug. Please email masneyb@newwave.net about it\n");
          return;
       }
+      flagcopy = tempfle->flags;
       success = 0;
       if((!wdata->local && ((tempfle->flags & FILE_ISDIR) || (tempfle->flags & FILE_ISLINK))) ||
          (wdata->local && tempfle->flags & FILE_ISDIR)) {
             success = chdirfunc(data);
       }
-      if(!(tempfle->flags & FILE_ISDIR) && !success) view_dialog(data);
+      if(!(flagcopy & FILE_ISDIR) && !success) view_dialog(data);
    }
 }
 /*****************************************************************************/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]