mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
lm35: fix potential reference of uninitialized memory
Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
parent
bfe64789b6
commit
99abe95a97
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
#include "lm35.h"
|
#include "lm35.h"
|
||||||
|
|
||||||
lm35_context lm35_init(int pin, float aref)
|
lm35_context lm35_init(int pin, float aref)
|
||||||
@ -33,6 +34,8 @@ lm35_context lm35_init(int pin, float aref)
|
|||||||
if (!dev)
|
if (!dev)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
memset((void *)dev, 0, sizeof(struct _lm35_context));
|
||||||
|
|
||||||
// make sure MRAA is initialized
|
// make sure MRAA is initialized
|
||||||
int mraa_rv;
|
int mraa_rv;
|
||||||
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user