Hi,

I noticed that some resources are not being freed in 'uemis-downloader.c' -
please, see attached patch...

All the best,
Marcos
From ec63d6c78c17f26220c5571fddf7c9c4e49b53e0 Mon Sep 17 00:00:00 2001
From: Marcos CARDINOT <[email protected]>
Date: Thu, 19 Mar 2015 16:32:31 -0300
Subject: [PATCH] uemis-downloader - resource leaks

Some resources are not being freed.

Signed-off-by: Marcos CARDINOT <[email protected]>
---
 uemis-downloader.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/uemis-downloader.c b/uemis-downloader.c
index b9ea57b..7b5a93a 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -718,6 +718,8 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
 		/* is it a valid entry or nothing ? */
 		if (strcmp(tp, "1.0") != 0 || strstr(inbuf, "divelog{1.0{{{{")) {
 			free(buf);
+			free(tp);
+			free(bp);
 			return false;
 		}
 	} else if (strcmp(tp, "dive") == 0) {
@@ -725,11 +727,15 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
 		tp = next_token(&bp);
 		if (strcmp(tp, "1.0") != 0) {
 			free(buf);
+			free(tp);
+			free(bp);
 			return false;
 		}
 	} else {
 		/* don't understand the buffer */
 		free(buf);
+		free(bp);
+		free(tp);
 		return false;
 	}
 	if (log) {
@@ -742,6 +748,9 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
 			fprintf(debugfile, "p_r_b entry deleted\n");
 #endif
 			/* oops, this one isn't valid, suggest to try the previous one */
+			free(buf);
+			free(bp);
+			free(tp);
 			return false;
 		}
 	}
-- 
1.7.9.5

From ec63d6c78c17f26220c5571fddf7c9c4e49b53e0 Mon Sep 17 00:00:00 2001
From: Marcos CARDINOT <[email protected]>
Date: Thu, 19 Mar 2015 16:32:31 -0300
Subject: [PATCH] uemis-downloader - resource leaks

Some resources are not being freed.

Signed-off-by: Marcos CARDINOT <[email protected]>
---
 uemis-downloader.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/uemis-downloader.c b/uemis-downloader.c
index b9ea57b..7b5a93a 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -718,6 +718,8 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
 		/* is it a valid entry or nothing ? */
 		if (strcmp(tp, "1.0") != 0 || strstr(inbuf, "divelog{1.0{{{{")) {
 			free(buf);
+			free(tp);
+			free(bp);
 			return false;
 		}
 	} else if (strcmp(tp, "dive") == 0) {
@@ -725,11 +727,15 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
 		tp = next_token(&bp);
 		if (strcmp(tp, "1.0") != 0) {
 			free(buf);
+			free(tp);
+			free(bp);
 			return false;
 		}
 	} else {
 		/* don't understand the buffer */
 		free(buf);
+		free(bp);
+		free(tp);
 		return false;
 	}
 	if (log) {
@@ -742,6 +748,9 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
 			fprintf(debugfile, "p_r_b entry deleted\n");
 #endif
 			/* oops, this one isn't valid, suggest to try the previous one */
+			free(buf);
+			free(bp);
+			free(tp);
 			return false;
 		}
 	}
-- 
1.7.9.5

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to