wiredtiger/wiredtiger — Issue #173: passing a NULL to memcpy in the new O_DIRECT code
Author: keithbostic
Created: 2012-02-25 20:22:35+00:00
State: open
Labels: Bug

Michael, lint says:

```
< _
< memcpy(newp, p, bytes_allocated);
< os_posix/os_alloc.c 137 Warning 668: Possibly passing a null pointer to
< function 'memcpy(void *, const void *, unsigned long)', arg. no. 2
< [Reference: file os_posix/os_alloc.c: line 129]
< os_posix/os_alloc.c 129 Info 831: Reference cited in prior message
```

Here's the code:

```

if (p == NULL && session != NULL && S2C(session)->stats != NULL)
WT_CSTAT_INCR(session, memalloc);

if ((ret = posix_memalign(&newp,
S2C(session)->buffer_alignment,
bytes_to_allocate)) != 0)
WT_RET_MSG(session, ret, "memory allocation");

memcpy(newp, p, bytes_allocated);
```

It looks to me like we might pass a NULL value for p into memcpy?