Fix double free 54/198754/1
authorjusung son <jusung07.son@samsung.com>
Thu, 17 Jan 2019 08:33:24 +0000 (17:33 +0900)
committerjusung son <jusung07.son@samsung.com>
Tue, 29 Jan 2019 07:28:07 +0000 (07:28 +0000)
Change-Id: Ie7448c3890582b7703c6fdbeda3dbc1589c38a28
Signed-off-by: jusung son <jusung07.son@samsung.com>
client/c_direct.c
common/common.c

index 73dab8c..a8e817d 100644 (file)
@@ -88,7 +88,7 @@ int c_direct_get(const struct buxton_layer *layer,
                UNUSED const char *rpriv, UNUSED const char *wpriv)
 {
        int r;
-       struct buxton_value val;
+       struct buxton_value val = { BUXTON_TYPE_UNKNOWN, };
        char err_buf[BUFFER_SIZE];
 
        if (!layer || !key || !*key) {
@@ -575,7 +575,7 @@ int c_direct_remove_garbage(const struct buxton_layer *layer,
 {
        struct buxton_layer *normal_layer;
        struct buxton_layer *base_layer;
-       struct buxton_value val;
+       struct buxton_value val = { BUXTON_TYPE_UNKNOWN, };
        char **keys;
        unsigned int len;
        int r;
index daf90fd..e5fa53e 100644 (file)
@@ -92,7 +92,10 @@ void value_free(struct buxton_value *val)
 
        switch (val->type) {
        case BUXTON_TYPE_STRING:
-               free(val->value.s);
+               if (val->value.s) {
+                       free(val->value.s);
+                       val->value.s = NULL;
+               }
                break;
        default:
                break;