Fix: segfault in buffer_reg_channel_destroy()
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 29 Apr 2013 21:13:56 +0000 (17:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 29 Apr 2013 22:00:46 +0000 (18:00 -0400)
Can be called with NULL pointer, which trigger segfault on ERR() which
try to dereference it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/bin/lttng-sessiond/buffer-registry.c

index 765294fa4ca33f11fe9b4f331a3c46e4e3bb0ac3..5751b8d587f8a1a12a64a1b2fc207aaba22b0534 100644 (file)
@@ -506,12 +506,14 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
                        buffer_reg_stream_destroy(sreg, domain);
                }
 
-               ret = ust_ctl_release_object(-1, regp->obj.ust);
-               if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
-                       ERR("Buffer reg channel release obj handle %d failed with ret %d",
-                                       regp->obj.ust->handle, ret);
+               if (regp->obj.ust) {
+                       ret = ust_ctl_release_object(-1, regp->obj.ust);
+                       if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
+                               ERR("Buffer reg channel release obj handle %d failed with ret %d",
+                                               regp->obj.ust->handle, ret);
+                       }
+                       free(regp->obj.ust);
                }
-               free(regp->obj.ust);
                lttng_fd_put(LTTNG_FD_APPS, 1);
                break;
        }
This page took 0.026239 seconds and 4 git commands to generate.