public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][committed] Fix PR67652: wrong sizeof calculation in liboffloadmic
@ 2015-09-28 16:21 Ilya Verbin
  2015-09-28 16:30 ` Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Verbin @ 2015-09-28 16:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: Kirill Yukhin, Jakub Jelinek

Committed to trunk as obvious.

	PR other/67652
	* runtime/offload_engine.cpp (Engine::init_process): Fix sizeof.

diff --git a/liboffloadmic/runtime/offload_engine.cpp b/liboffloadmic/runtime/offload_engine.cpp
index 16b440d..00b673a 100644
--- a/liboffloadmic/runtime/offload_engine.cpp
+++ b/liboffloadmic/runtime/offload_engine.cpp
@@ -173,7 +173,7 @@ void Engine::init_process(void)
             // use putenv instead of setenv as Windows has no setenv.
             // Note: putenv requires its argument can't be freed or modified.
             // So no free after call to putenv or elsewhere.
-            char * env_var = (char*) malloc(sizeof("COI_DMA_CHANNEL_COUNT=2" + 1));
+            char * env_var = (char*) malloc(sizeof("COI_DMA_CHANNEL_COUNT=2"));
             sprintf(env_var, "COI_DMA_CHANNEL_COUNT=2");
             putenv(env_var);  
         }

  -- Ilya

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-08 19:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28 16:21 [PATCH][committed] Fix PR67652: wrong sizeof calculation in liboffloadmic Ilya Verbin
2015-09-28 16:30 ` Jakub Jelinek
2015-09-28 16:32   ` Ilya Verbin
2015-09-28 16:50   ` Andrew Pinski
2015-10-08 19:09     ` Ilya Verbin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).