diff options
| author | James Maki <jmaki@multitech.com> | 2010-05-07 10:19:01 -0500 | 
|---|---|---|
| committer | James Maki <jmaki@multitech.com> | 2010-05-07 10:19:01 -0500 | 
| commit | cce54aff649a226b987a13638f8dfcc56179d64a (patch) | |
| tree | 9e6cd5f3a62e77346ce6b7358f02fb390ea06674 | |
| parent | b7e06668878af06fc6e74842861e725b982b142f (diff) | |
| download | sms-utils-cce54aff649a226b987a13638f8dfcc56179d64a.tar.gz sms-utils-cce54aff649a226b987a13638f8dfcc56179d64a.tar.bz2 sms-utils-cce54aff649a226b987a13638f8dfcc56179d64a.zip | |
free lock_path
| -rw-r--r-- | src/atcmd.c | 13 | 
1 files changed, 7 insertions, 6 deletions
| diff --git a/src/atcmd.c b/src/atcmd.c index 6dee9ed..e153d39 100644 --- a/src/atcmd.c +++ b/src/atcmd.c @@ -1127,6 +1127,8 @@ int sms_device_close(int fd)  	if (lock_path) {  		unlink(lock_path); +		free(lock_path); +		lock_path = NULL;  	}  	return ret; @@ -1134,32 +1136,31 @@ int sms_device_close(int fd)  int sms_device_open(void)  { -	int fd; +	int fd = -1;  	int tmp;  	lock_path = device_lock(Global.core.device);  	if (!lock_path) { +		sms_device_close(fd);  		return -1;  	}  	fd = tty_open(Global.core.device, Global.core.baud_rate);  	if (fd < 0) { -		unlink(lock_path); +		sms_device_close(fd);  		return -1;  	}  	tmp = tty_set_read_timeout(fd, Global.core.read_timeout);  	if (tmp < 0) { -		close(fd); -		unlink(lock_path); +		sms_device_close(fd);  		return tmp;  	}  	if (Global.core.sms_init) {  		tmp = sms_atcmd_init(fd);  		if (tmp < 0) { -			close(fd); -			unlink(lock_path); +			sms_device_close(fd);  			return tmp;  		}  	} | 
