Change in osmocom-bb[master]: mobile/sms: Fix memory leak in case the storage can not be opened

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Sat Jun 2 11:05:06 UTC 2018


Holger Freyther has uploaded this change for review. ( https://gerrit.osmocom.org/9417


Change subject: mobile/sms: Fix memory leak in case the storage can not be opened
......................................................................

mobile/sms: Fix memory leak in case the storage can not be opened

Before jumping to the failure handling code free the sms_file.

Change-Id: Ifce2bc130fe3a5bd49ad457ee61002952dd496ba
---
M src/host/layer23/src/mobile/gsm411_sms.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/17/9417/1

diff --git a/src/host/layer23/src/mobile/gsm411_sms.c b/src/host/layer23/src/mobile/gsm411_sms.c
index 9090697..3eca48a 100644
--- a/src/host/layer23/src/mobile/gsm411_sms.c
+++ b/src/host/layer23/src/mobile/gsm411_sms.c
@@ -213,8 +213,10 @@
 	snprintf(sms_file, len, "%s/%s", home, osmocomsms);
 
 	fp = fopen(sms_file, "a");
-	if (!fp)
+	if (!fp) {
+		talloc_free(sms_file);
 		goto fail;
+	}
 	fprintf(fp, "[SMS from %s]\n%s\n", gsms->address, gsms->text);
 	fclose(fp);
 

-- 
To view, visit https://gerrit.osmocom.org/9417
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifce2bc130fe3a5bd49ad457ee61002952dd496ba
Gerrit-Change-Number: 9417
Gerrit-PatchSet: 1
Gerrit-Owner: Holger Freyther <holger at freyther.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180602/b6658432/attachment.htm>


More information about the gerrit-log mailing list