dict: de-allocate data on dict-set failures
Found the bug while browsing code. Very difficult to hit this though. Change-Id: I84bd5d23d19b6aa16866fc0f1b56aa22cb8a5f1f BUG: 1079215 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/7310 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
c52ab5eb52
commit
3ea85192f1
@ -1602,6 +1602,8 @@ dict_set_int8 (dict_t *this, char *key, int8_t val)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1645,6 +1647,8 @@ dict_set_int16 (dict_t *this, char *key, int16_t val)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1688,6 +1692,8 @@ dict_set_int32 (dict_t *this, char *key, int32_t val)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1731,6 +1737,8 @@ dict_set_int64 (dict_t *this, char *key, int64_t val)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1774,6 +1782,8 @@ dict_set_uint16 (dict_t *this, char *key, uint16_t val)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1818,6 +1828,8 @@ dict_set_uint32 (dict_t *this, char *key, uint32_t val)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1861,6 +1873,8 @@ dict_set_uint64 (dict_t *this, char *key, uint64_t val)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1903,6 +1917,8 @@ dict_set_double (dict_t *this, char *key, double val)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1921,6 +1937,8 @@ dict_set_static_ptr (dict_t *this, char *key, void *ptr)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -1939,6 +1957,8 @@ dict_set_dynptr (dict_t *this, char *key, void *ptr, size_t len)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -2015,6 +2035,8 @@ dict_set_ptr (dict_t *this, char *key, void *ptr)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -2061,6 +2083,8 @@ dict_set_str (dict_t *this, char *key, char *str)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -2096,6 +2120,8 @@ dict_set_dynstr (dict_t *this, char *key, char *str)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -2117,6 +2143,8 @@ dict_set_dynmstr (dict_t *this, char *key, char *str)
|
||||
}
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -2173,6 +2201,8 @@ dict_set_bin (dict_t *this, char *key, void *ptr, size_t size)
|
||||
data->is_static = 0;
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
@ -2201,6 +2231,8 @@ dict_set_static_bin (dict_t *this, char *key, void *ptr, size_t size)
|
||||
data->is_static = 1;
|
||||
|
||||
ret = dict_set (this, key, data);
|
||||
if (ret < 0)
|
||||
data_destroy (data);
|
||||
|
||||
err:
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user