[MacPorts] #40978: emacs-app @24.3_1/emacs-mac-app @4.4: memory bug in patch-src_emacs.c.diff
MacPorts
noreply at macports.org
Sat Oct 26 23:44:33 PDT 2013
#40978: emacs-app @24.3_1/emacs-mac-app @4.4: memory bug in patch-src_emacs.c.diff
------------------------+-------------------------------------
Reporter: takanori@… | Owner: hum@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.2.0
Keywords: haspatch | Port: emacs-app emacs-mac-app
------------------------+-------------------------------------
I noticed that there is a minor bug in patch-src_emacs.c.diff.
{{{
[patch-src_emacs.c.diff]
...
+ /* Imaxima won't work properly if PATH does not contain the
+ MacPorts directory. The following code is a workaround to
+ avoid this problem. */
+ {
+ char *oldpath = getenv("PATH");
+ if (!oldpath) {oldpath = "";}
+ size_t oldpathsize = strlen(oldpath) + 1;
+ if (!strstr(oldpath, "__PREFIX__/bin")) {
+ char *newpath;
+ size_t newpathsize = oldpathsize + strlen("__PREFIX__/bin:");
+ if ((newpath = (char *)malloc(newpathsize)) != NULL) {
+ strlcpy(newpath, "__PREFIX__/bin:", newpathsize);
+ strlcat(newpath, oldpath, newpathsize);
+ setenv("PATH", newpath, 1);
+ free(newpath);
+ }
+ }
+ }
...
}}}
setenv(3) says the string pointed to by the 2nd argument of setenv
shouldn't be altered/freed during the application program is running.
i.e. The line "free(newpath);" should be commented out.
--
Ticket URL: <https://trac.macports.org/ticket/40978>
MacPorts <http://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list