Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/12/84; site desint.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ittvax!dcdwest!sdcsvax!sdcrdcf!trwrb!desint!geoff From: geoff@desint.UUCP (Geoff Kuenning) Newsgroups: net.sources.bugs Subject: Fix for a malloc problem in patch Message-ID: <246@desint.UUCP> Date: Mon, 26-Nov-84 16:32:58 EST Article-I.D.: desint.246 Posted: Mon Nov 26 16:32:58 1984 Date-Received: Thu, 29-Nov-84 04:25:20 EST References: <320@rna.UUCP> Organization: his home computer, Manhattan Beach, CA Lines: 35 In article <320@rna.UUCP> dan@rna.UUCP (Dan Ts'o) writes: > Alas things are still not well with patch - I occassionally get >core dumps in malloc(), via savestr(), but I haven't had a chance to >track that one down yet. It seems to happen when patch can't find the >appropriate file, but it may be something else. Sigh... A valiant >program, tho... I have found a malloc bug in patch that made it completely unworkable on my system. Hand-made context diff's follow; please no flames if they fail to pass through 'patch'. *** patch.c.orig Nov 25 01:56 --- patch.c Nov 26 13:02 *************** *** 753,759 if (*s == '\n') iline++; } ! i_ptr = (char **)malloc((iline + 1) * sizeof(char *)); if (i_ptr == Null(char **)) { /* shucks, it was a near thing */ free(i_womp); return FALSE; --- 753,759 ----- if (*s == '\n') iline++; } ! i_ptr = (char **)malloc((iline + 2) * sizeof(char *)); if (i_ptr == Null(char **)) { /* shucks, it was a near thing */ free(i_womp); return FALSE; -- Geoff Kuenning ...!ihnp4!trwrb!desint!geoff