summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-ds1307.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 2b46ae5..e2d561b 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -17,6 +17,7 @@
#include <init.h>
#include <driver.h>
#include <xfuncs.h>
+#include <malloc.h>
#include <errno.h>
#include <i2c/i2c.h>
#include <rtc.h>
@@ -422,6 +423,8 @@ read_rtc:
err = rtc_register(&ds1307->rtc);
exit:
+ if (err)
+ free(ds1307);
return err;
}