...
@@ -184,10 +177,8 @@ static int virChrdevLockFileCreate(const char
*dev)
*/
static void virChrdevLockFileRemove(const char *dev)
{
- char *path = virChrdevLockFilePath(dev);
- if (path)
- unlink(path);
- VIR_FREE(path);
+ g_autofree char *path = virChrdevLockFilePath(dev);
+ unlink(path);
I assume that you deleted the 'if' clause only because virChrdevLockFileRemove
is only called from virChrdevHashEntryFree and the existence of the lockfile is
therefore implicitly assumed? Because I'm not sure unlink can handle NULL,
especially if it blindly calls strlen on the input.
With your assurance of the above:
Reviewed-by: Erik Skultety <eskultet(a)redhat.com>