Fix a memory allocation issue

This commit is contained in:
Manolis Surligas 2016-04-02 22:26:31 +03:00
parent 82c9ff2850
commit 97b141d267
1 changed files with 2 additions and 2 deletions

View File

@ -100,7 +100,7 @@ namespace gr
} }
/* All good until now. Allocate buffer memory and proceed */ /* All good until now. Allocate buffer memory and proceed */
buf = new uint8_t(d_mtu); buf = new uint8_t[d_mtu];
while(d_running){ while(d_running){
ret = recvfrom(sock, buf, d_mtu, 0, &client_addr, &client_addr_len); ret = recvfrom(sock, buf, d_mtu, 0, &client_addr, &client_addr_len);
@ -115,7 +115,7 @@ namespace gr
} }
} }
close(sock); close(sock);
delete buf; delete[] buf;
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
} }