From: Marc Dionne Date: Thu, 9 May 2013 16:30:39 +0000 (-0400) Subject: ubik: Avoid use of freed string X-Git-Tag: upstream/1.8.0_pre1^2~1169 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=641b2fd8d6a270a2fc202450ab8dce044afc48a2;p=packages%2Fo%2Fopenafs.git ubik: Avoid use of freed string If cellName was just set to dir->cellName, afsconf_Close() will free the string before fprintf uses it. Just change the order so we don't access freed memory and print garbage. Change-Id: I66792dc50addf2d8242f71923db09fcc178cc450 Reviewed-on: http://gerrit.openafs.org/9886 Tested-by: BuildBot Reviewed-by: Simon Wilkinson Reviewed-by: Jeffrey Altman --- diff --git a/src/ubik/uinit.c b/src/ubik/uinit.c index ca83acca8..a61a02950 100644 --- a/src/ubik/uinit.c +++ b/src/ubik/uinit.c @@ -143,10 +143,10 @@ internal_client_init_dir(const char *confDir, char *cellName, int secFlags, code = afsconf_GetCellInfo(dir, cellName, serviceid, &info); if (code) { - afsconf_Close(dir); fprintf(stderr, "%s: can't find cell %s's hosts in %s/%s\n", progname?progname:"", cellName, confDir, AFSDIR_CELLSERVDB_FILE); + afsconf_Close(dir); return code; }