diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2018-06-02 11:12:50 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2018-06-02 11:12:50 +0800 |
commit | 61fe379446a70946ac9da417042a5177ac5dac96 (patch) | |
tree | ea249b1f729f4865a865486d4e04801098d90c14 /src | |
parent | 5a3dd6eb1acb9365ffef534be54a5e7644c1f6c9 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/host/layer23/src/mobile/gsm411_sms.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/host/layer23/src/mobile/gsm411_sms.c b/src/host/layer23/src/mobile/gsm411_sms.c index 90906973..3eca48a9 100644 --- a/src/host/layer23/src/mobile/gsm411_sms.c +++ b/src/host/layer23/src/mobile/gsm411_sms.c @@ -213,8 +213,10 @@ fail: 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); |