Cleanup of detect return

This commit is contained in:
Lorenz Meier 2013-08-30 17:05:21 +02:00
parent 61936412f3
commit e2b602339a
1 changed files with 9 additions and 11 deletions

View File

@ -1966,18 +1966,16 @@ detect(int argc, char *argv[])
if (g_dev == nullptr) if (g_dev == nullptr)
errx(1, "driver alloc failed"); errx(1, "driver alloc failed");
if (OK != g_dev->detect()) { ret = g_dev->detect()
delete g_dev;
g_dev = nullptr; delete g_dev;
g_dev = nullptr;
if (ret)
/* nonzero, error */
exit(1); exit(1);
} else
exit(0);
if (g_dev != nullptr) {
delete g_dev;
g_dev = nullptr;
}
exit(0);
} }
void void