From: Mikko Rasa Date: Mon, 16 Jul 2012 23:24:52 +0000 (+0300) Subject: Variable length arrays on stack are not valid C++ X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=commitdiff_plain;h=699670a264c7fc5a0b05c2d258a7552f5c594bd1;hp=c8af8a2167685dc52c6e77951f3fa6ee53d67654 Variable length arrays on stack are not valid C++ --- diff --git a/source/time/timezone.cpp b/source/time/timezone.cpp index a755954..a2cd7a3 100644 --- a/source/time/timezone.cpp +++ b/source/time/timezone.cpp @@ -61,7 +61,7 @@ TimeZone get_local_timezone() long typecnt = get_long(ptr); long charcnt = get_long(ptr); int size = timecnt*5+typecnt*6+isgmtcnt+isstdcnt+leapcnt*8+charcnt; - char buf[size]; + char *buf = new char[size]; len = read(fd, buf, size); if(len==size) { @@ -91,6 +91,7 @@ TimeZone get_local_timezone() name = ptr+abbrind; } + delete[] buf; } close(fd);