From: Thibault Godouet Date: Tue, 5 Sep 2000 19:52:33 +0000 (+0000) Subject: bug corrected : used to free directly the value of getenv() X-Git-Tag: ver2_9_4~602 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b6adf7ddcb5434d57f00d8c120023ee17595c53;p=thirdparty%2Ffcron.git bug corrected : used to free directly the value of getenv() now strdup2 this value in order to free the result safely in delete_file --- diff --git a/fcrontab.c b/fcrontab.c index 34529db..d0e4ea4 100644 --- a/fcrontab.c +++ b/fcrontab.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcrontab.c,v 1.12 2000-08-22 18:01:32 thib Exp $ */ + /* $Id: fcrontab.c,v 1.13 2000-09-05 19:52:33 thib Exp $ */ /* * The goal of this program is simple : giving a user interface to fcron @@ -42,7 +42,7 @@ #include "fcrontab.h" -char rcs_info[] = "$Id: fcrontab.c,v 1.12 2000-08-22 18:01:32 thib Exp $"; +char rcs_info[] = "$Id: fcrontab.c,v 1.13 2000-09-05 19:52:33 thib Exp $"; void info(void); void usage(void); @@ -658,7 +658,9 @@ parseopt(int argc, char *argv[]) } if ( user == NULL ) { - if ((user = getenv("USER")) == NULL) { + /* we need to strdup2 the value given by getenv() because we free + * file->cf_user in delete_file */ + if ((user = strdup2(getenv("USER"))) == NULL) { fprintf(stderr, "Could not get user name.\n"); xexit(EXIT_ERR); }