From: mpv Date: Thu, 7 Apr 2005 11:49:37 +0000 (+0000) Subject: mpv: memory leak fix: gethostname method returns 0 if OK X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a6ea03a3d5aac7669d82a91360dce07995e009e;p=modules%2Fkernel.git mpv: memory leak fix: gethostname method returns 0 if OK --- diff --git a/src/Utils/OpUtil.cxx b/src/Utils/OpUtil.cxx index 00ed5a66d..0ae6cd8a9 100644 --- a/src/Utils/OpUtil.cxx +++ b/src/Utils/OpUtil.cxx @@ -35,10 +35,10 @@ int gethostname(char *name, size_t len); string GetHostname() { - int ls = 100, r = 0; + int ls = 100, r = 1; char *s; - while (ls < 10000) { + while (ls < 10000 && r) { ls *= 2; s = new char[ls]; r = gethostname(s, ls-1);