From: David Lawrence Ramsey Date: Wed, 5 Jul 2006 03:38:49 +0000 (+0000) Subject: in do_browse_from(), during the operating directory check, if path isn't X-Git-Tag: v1.9.99pre1~115 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=a7bdd2e9c683c07507fcef336ca05e63243aa837;p=nano.git in do_browse_from(), during the operating directory check, if path isn't NULL, don't bother freeing it before mallocstrcpy()ing operating_dir into it, as the latter operation will free it git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3746 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 15ed992d..82c2db5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,10 @@ CVS code - - After entering "..", select the directory we were in before instead of the first filename in the list, as Pico does. (DLR) - Simplify screen update handling and exiting. (DLR) + do_browse_from() + - During the operating directory check, if path isn't NULL, + don't bother freeing it before mallocstrcpy()ing operating_dir + into it, as the latter operation will free it. (DLR) browser_init() - Fix off-by-one error when calculating longest that kept the rightmost column of the screen from being used. (DLR) diff --git a/src/browser.c b/src/browser.c index 868b87c3..3932a956 100644 --- a/src/browser.c +++ b/src/browser.c @@ -415,11 +415,8 @@ char *do_browse_from(const char *inpath) #ifndef DISABLE_OPERATINGDIR /* If the resulting path isn't in the operating directory, use * the operating directory instead. */ - if (check_operating_dir(path, FALSE)) { - if (path != NULL) - free(path); - path = mallocstrcpy(NULL, operating_dir); - } + if (check_operating_dir(path, FALSE)) + path = mallocstrcpy(path, operating_dir); #endif if (path != NULL)