From d3b00b0a86b2e4b38010daca7acd12eafd7f6c0c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 15:10:06 +0000 Subject: [PATCH] Fix memory leaks in command line parsing. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4816 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensord/args.c | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 5974c54e..d62c45fa 100644 --- a/CHANGES +++ b/CHANGES @@ -56,6 +56,7 @@ SVN HEAD Program sensord: Syncronize the version with lm-sensors Drop all the chip-specific support Fix a memory leak when daemonizing + Fix memory leaks in command line parsing Program sensors: Drop all the chip-specific support Fix alignment of alarm for one-limit temperatures Drop option -U diff --git a/prog/sensord/args.c b/prog/sensord/args.c index d2278259..a492fc8b 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -212,24 +212,20 @@ parseArgs doSet = 1; break; case 'c': - if ((sensorsCfgFile = strdup (optarg)) == NULL) - return -1; + sensorsCfgFile = optarg; break; case 'p': - if ((pidFile = strdup (optarg)) == NULL) - return -1; + pidFile = optarg; break; case 'r': - if ((rrdFile = strdup (optarg)) == NULL) - return -1; + rrdFile = optarg; break; case 'd': debug = 1; break; case 'g': doCGI = 1; - if ((cgiDir = strdup (optarg)) == NULL) - return -1; + cgiDir = optarg; break; case 'v': printf ("sensord version %s\n", LM_VERSION);