If we tried to copy a divecomputer without samples, we where to malloc a
zero sized blob. dives/test15.xml triggered this and it was found with
valgrind.
Signed-off-by: Anton Lundin gla...@acc.umu.se
---
dive.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dive.c b/dive.c
On Thu, Dec 11, 2014 at 3:31 PM, Anton Lundin gla...@acc.umu.se wrote:
If we tried to copy a divecomputer without samples, we where to malloc a
zero sized blob. dives/test15.xml triggered this and it was found with
valgrind.
This is *not* correct.
First off, allocating a zero-sized area is
On 11 December, 2014 - Linus Torvalds wrote:
On Thu, Dec 11, 2014 at 3:31 PM, Anton Lundin gla...@acc.umu.se wrote:
If we tried to copy a divecomputer without samples, we where to malloc a
zero sized blob. dives/test15.xml triggered this and it was found with
valgrind.
This is *not*
On Dec 11, 2014 11:07 PM, Anton Lundin gla...@acc.umu.se wrote:
So, should the right approach here be not to trust malloc returning NULL
here and we explicitly set sample to null if s-samples == 0 ?
That sounds fine, yes.
Or just initialize the fields to zero/NULL and then do that
if (!nr)