Changeset e97c4a30


Ignore:
Timestamp:
Feb 2, 2009, 1:17:44 PM (11 years ago)
Author:
Geoffrey Thomas <geofft@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
50e671c
Parents:
637d983
git-author:
Geoffrey Thomas <geofft@mit.edu> (02/02/09 13:03:09)
git-committer:
Geoffrey Thomas <geofft@mit.edu> (02/02/09 13:17:44)
Message:
util.c: Fix double-free from owl_zephyr_delsub.

Also fix general memory-handling incompetence, including a use-after-free and a
leak. There are probably still errors here; we should rewrite the whole
function as per the comment at the top.

Reported-by: Quentin Smith <quentin@mit.edu>
Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • util.c

    r6eaf35b re97c4a30  
    641641      owl_function_error("Error opening file %s for writing", backupfilename);
    642642      owl_free(backupfilename);
     643      fclose(file);
    643644      return;
    644645    }
    645     owl_free(backupfilename);
    646646  }
    647647
     
    682682    owl_function_error("WARNING: Error opening %s for writing.  Use %s to restore.", filename, backupfilename);
    683683    owl_function_beep();
    684     owl_free(line);
    685     return;
    686   }
    687 
    688   fputs(text, file);
    689   fclose(file);
     684  } else {
     685    fputs(text, file);
     686    fclose(file);
     687  }
     688
     689  if (backup)
     690    owl_free(backupfilename);
     691  owl_free(text);
    690692}
    691693
Note: See TracChangeset for help on using the changeset viewer.