Fix: ustctl_release_object: eliminate double-close/free on error
[lttng-ust.git] / liblttng-ust-ctl / ustctl.c
index ea5ab9dc4ed3ce29cd3dad50b1cc16c4bc32167a..69bbd21a0959c93bbd870166ca1b56b8cc34533f 100644 (file)
@@ -111,8 +111,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) {
@@ -121,6 +123,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);
@@ -128,6 +131,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.023235 seconds and 4 git commands to generate.