ext/libusdt/test_usdt.c in ruby-usdt-0.1.1 vs ext/libusdt/test_usdt.c in ruby-usdt-0.1.2

- old
+ new

@@ -9,21 +9,20 @@ #include <string.h> static void fire_probe(usdt_probedef_t *probedef, int argc, void **argv) { - if (usdt_is_enabled(probedef->probe)) { + if (usdt_is_enabled(probedef->probe)) usdt_fire_probe(probedef->probe, argc, argv); - } } int main(int argc, char **argv) { usdt_provider_t *provider; usdt_probedef_t *probedef; char char_argv[USDT_ARG_MAX]; int int_argv[USDT_ARG_MAX * 2]; - void **args; + void **args = NULL; int i; char buf[255]; for (i = 0; i < USDT_ARG_MAX; i++) int_argv[i] = i + 1; @@ -73,8 +72,16 @@ fprintf(stdout, "enabled\n"); fflush(stdout); fgets(buf, 255, stdin); fire_probe(probedef, (argc-3), (void **)args); + usdt_probe_release(probedef); + + if ((usdt_provider_disable(provider)) < 0) { + fprintf(stderr, "unable to disable provider: %s\n", usdt_errstr(provider)); + exit (1); + } + + usdt_provider_free(provider); return 0; }