Fix trivial memory leak.
authorDavin McCall <davmac@davmac.org>
Sun, 12 Mar 2017 23:16:15 +0000 (23:16 +0000)
committerDavin McCall <davmac@davmac.org>
Sun, 12 Mar 2017 23:16:15 +0000 (23:16 +0000)
src/shutdown.cc

index 63474edf197a5fb302383949f7d6938555eee37f..b9ff24cb03aea5b61f9118d2c11dcea2b7734d2f 100644 (file)
@@ -140,9 +140,8 @@ int main(int argc, char **argv)
     }
 
     // Build buffer;
-    //uint16_t sname_len = strlen(service_name);
-    int bufsize = 2;
-    char * buf = new char[bufsize];
+    constexpr int bufsize = 2;
+    char buf[bufsize];
     
     buf[0] = DINIT_CP_SHUTDOWN;
     buf[1] = static_cast<char>(shutdown_type);