[sr-dev] git:master:90284a0f: ratelimit: close file pointer in case of scan error

Daniel-Constantin Mierla miconda at gmail.com
Wed Nov 2 15:47:34 CET 2016


Module: kamailio
Branch: master
Commit: 90284a0f43a6782d0241e1e48c0dcfc3b084ddeb
URL: https://github.com/kamailio/kamailio/commit/90284a0f43a6782d0241e1e48c0dcfc3b084ddeb

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-11-02T15:42:55+01:00

ratelimit: close file pointer in case of scan error

---

Modified: modules/ratelimit/ratelimit.c

---

Diff:  https://github.com/kamailio/kamailio/commit/90284a0f43a6782d0241e1e48c0dcfc3b084ddeb.diff
Patch: https://github.com/kamailio/kamailio/commit/90284a0f43a6782d0241e1e48c0dcfc3b084ddeb.patch

---

diff --git a/modules/ratelimit/ratelimit.c b/modules/ratelimit/ratelimit.c
index dc5748f..69fcd74 100644
--- a/modules/ratelimit/ratelimit.c
+++ b/modules/ratelimit/ratelimit.c
@@ -338,6 +338,7 @@ static int get_cpuload(double * load)
 	if (fscanf(f, "cpu  %lld%lld%lld%lld%lld%lld%lld%lld",
 			&n_user, &n_nice, &n_sys, &n_idle, &n_iow, &n_irq, &n_sirq, &n_stl) < 0) {
 		  LM_ERR("could not parse load information\n");
+		  fclose(f);
 		  return -1;
 	}
 	fclose(f);




More information about the sr-dev mailing list