lm35: fix potential reference of uninitialized memory

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson 2016-10-25 17:02:26 -06:00
parent bfe64789b6
commit 99abe95a97

View File

@ -23,6 +23,7 @@
*/
#include <assert.h>
#include <string.h>
#include "lm35.h"
lm35_context lm35_init(int pin, float aref)
@ -33,6 +34,8 @@ lm35_context lm35_init(int pin, float aref)
if (!dev)
return NULL;
memset((void *)dev, 0, sizeof(struct _lm35_context));
// make sure MRAA is initialized
int mraa_rv;
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)