[IOT-1783] Fix output buffer size
authorDan Mihai <Daniel.Mihai@microsoft.com>
Fri, 27 Jan 2017 21:00:52 +0000 (13:00 -0800)
committerMike Fenelon <mike.fenelon@microsoft.com>
Fri, 3 Feb 2017 23:53:39 +0000 (23:53 +0000)
commit355a055649298b20f2b4274a4b82c93b9056b7d0
tree88d3911874ad9ad4c19bf896810e1f7594671923
parenta69860c746b180930f2eb7329c958a3d59e2299e
[IOT-1783] Fix output buffer size

1. Don't allocate securityPayloadSize and use INIT_SIZE as the buffer
   size parameter, when calling OCConvertPayloadHelper.

2. Using Realloc here was wasteful, because Realloc copies the
   current buffer contents in the new, larger buffer. The current
   buffer contents are not needed in the larger buffer.

3. Call OCConvertPayloadHelper in a single place instead of three.

Change-Id: Ib854d91c5938df10597207f4aa88945dd8720cf5
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16859
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Mike Fenelon <mike.fenelon@microsoft.com>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
resource/csdk/stack/src/ocpayloadconvert.c