mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
bosserver: use normal asprintf idiom
We generally tend to explicitly NULL out the buffer argument if asprintf() returns failure, since it is not guaranteed to have done so itself. It is even less clear whether setting the buffer argument to NULL ourselves before calling asprintf() will be untouched in all possible failures, so re-zero it after failed calls just to be sure we don't try to free garbage later. Change-Id: Ie8995472aeadb8043f5e43f4e6d197a7be1363e0 Reviewed-on: https://gerrit.openafs.org/15832 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
This commit is contained in:
parent
5a20d9e219
commit
3bf2a27566
@ -713,14 +713,18 @@ make_pid_filename(char *ainst, char *aname)
|
||||
|
||||
if (aname && *aname) {
|
||||
r = asprintf(&buffer, "%s/%s.%s.pid", DoPidFiles, ainst, aname);
|
||||
if (r < 0 || buffer == NULL)
|
||||
if (r < 0 || buffer == NULL) {
|
||||
ViceLog(0, ("Failed to alloc pid filename buffer for %s.%s.\n",
|
||||
ainst, aname));
|
||||
buffer = NULL;
|
||||
}
|
||||
} else {
|
||||
r = asprintf(&buffer, "%s/%s.pid", DoPidFiles, ainst);
|
||||
if (r < 0 || buffer == NULL)
|
||||
if (r < 0 || buffer == NULL) {
|
||||
ViceLog(0, ("Failed to alloc pid filename buffer for %s.\n",
|
||||
ainst));
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user