Don't leak the malloc'd path variable everytime we call truncateDatabase
Caught by clang-analyzer
Change-Id: I583d81b136113820dab00a6eb35ca8e1aeec2cd1
Reviewed-on: http://gerrit.openafs.org/7105
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
afs_int32 code = 0;
int fd;
- path =
- (char *)malloc(strlen(globalConfPtr->databaseDirectory) +
- strlen(globalConfPtr->databaseName) +
- strlen(globalConfPtr->databaseExtension) + 1);
- if (path == 0)
+ path = malloc(strlen(globalConfPtr->databaseDirectory) +
+ strlen(globalConfPtr->databaseName) +
+ strlen(globalConfPtr->databaseExtension) + 1);
+ if (path == NULL)
ERROR(-1);
/* construct the database name */
close(fd);
}
+ free(path);
+
error_exit:
return (code);
}