From 917b56374d0927c562a6ebc22ff8b069444e9f96 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 3 Nov 2012 14:15:23 +0000 Subject: [PATCH] iscsi-scstd: Fix code for replacing an attribute value (merge r4545 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4581 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/usr/config.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/iscsi-scst/usr/config.c b/iscsi-scst/usr/config.c index 0ea77feea..e183c402c 100644 --- a/iscsi-scst/usr/config.c +++ b/iscsi-scst/usr/config.c @@ -194,8 +194,6 @@ int iscsi_attr_replace(struct __qelem *attrs_list, const char *sysfs_name, a = iscsi_attr_lookup_by_key(attrs_list, key); - list_add_tail(attr, attrs_list); - if ((a != NULL) && (a != attr)) { log_error("Attr %s (sysfs_name %s) already exists\n", key, a->sysfs_name); @@ -215,6 +213,7 @@ int iscsi_attr_replace(struct __qelem *attrs_list, const char *sysfs_name, if (new_val == NULL) { log_error("Unable to duplicate attr_value %s", val); res = -ENOMEM; + free(new_key); goto out; } } else