Fix: ustctl_release_object: eliminate double-close/free on error
[deliverable/lttng-ust.git] / liblttng-ust-ctl / ustctl.c
index c2b761a1b7cccba3fea0fd0dfad2cc074036b45e..a7bee029db524a4450dd2a7d65ebc4cfed6533c5 100644 (file)
@@ -109,8 +109,10 @@ int ustctl_release_object(int sock, struct lttng_ust_object_data *data)
                                ret = -errno;
                                return ret;
                        }
+                       data->u.channel.wakeup_fd = -1;
                }
                free(data->u.channel.data);
+               data->u.channel.data = NULL;
                break;
        case LTTNG_UST_OBJECT_TYPE_STREAM:
                if (data->u.stream.shm_fd >= 0) {
@@ -119,6 +121,7 @@ int ustctl_release_object(int sock, struct lttng_ust_object_data *data)
                                ret = -errno;
                                return ret;
                        }
+                       data->u.stream.shm_fd = -1;
                }
                if (data->u.stream.wakeup_fd >= 0) {
                        ret = close(data->u.stream.wakeup_fd);
@@ -126,6 +129,7 @@ int ustctl_release_object(int sock, struct lttng_ust_object_data *data)
                                ret = -errno;
                                return ret;
                        }
+                       data->u.stream.wakeup_fd = -1;
                }
                break;
        case LTTNG_UST_OBJECT_TYPE_EVENT:
This page took 0.025851 seconds and 5 git commands to generate.