When null is checked after dynamic allocation we need to return. If we
From: Erik Hovland <erik@hovland.org>
don't then we will attempt to dereference a null pointer and segfault.
---
libs/libmyth/bio2jack.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/libs/libmyth/bio2jack.c b/libs/libmyth/bio2jack.c
index b4b348d..5589350 100755
a
|
b
|
long JACK_Write(int deviceID, unsigned char *data, unsigned long bytes) |
1218 | 1218 | if (!newWaveHeader) |
1219 | 1219 | { |
1220 | 1220 | ERR("error allocating memory for newWaveHeader\n"); |
| 1221 | return 0; |
1221 | 1222 | } |
1222 | 1223 | |
1223 | 1224 | newWaveHeader->pData = (unsigned char*)malloc(sizeof(unsigned char) * bytes); /* allocate memory for the data */ |