From: Davin McCall Date: Thu, 14 Jan 2016 10:02:40 +0000 (+0000) Subject: Use delete[] to delete buffers allocated via new[] X-Git-Tag: v0.01~26 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bc759e0e9e916d7d70c2ec0b485337f12231dbf3;p=oweals%2Fdinit.git Use delete[] to delete buffers allocated via new[] (thank you LLVM static analyzer...) --- diff --git a/src/dinitctl.cc b/src/dinitctl.cc index 742b2de..8a7f111 100644 --- a/src/dinitctl.cc +++ b/src/dinitctl.cc @@ -293,7 +293,7 @@ int main(int argc, char **argv) buf[1] = do_pin ? 1 : 0; memcpy(buf + 2, &handle, sizeof(handle)); r = write_all(socknum, buf, 2 + sizeof(handle)); - delete buf; + delete [] buf; if (r == -1) { perror("write"); @@ -458,7 +458,7 @@ static int unpinService(int socknum, const char *service_name) buf[0] = DINIT_CP_UNPINSERVICE; memcpy(buf + 1, &handle, sizeof(handle)); r = write_all(socknum, buf, 2 + sizeof(handle)); - delete buf; + delete [] buf; if (r == -1) { perror("write");