浏览代码

core: fix memleak in fixup_free*

fparam_free_contents() (which is what all the fixup_free* call in
sr) did not free the original string (which in sr is kept inside
 the fixed fparam/gparam).
It should have no impact, since at this point nobody seems to use
 any fixup_free* functions.
Andrei Pelinescu-Onciul 16 年之前
父节点
当前提交
af8f3e1536
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      sr_module.c

+ 5 - 1
sr_module.c

@@ -1189,7 +1189,7 @@ void fparam_free_contents(fparam_t* fp)
 		case FPARAM_INT:
 		case FPARAM_INT:
 		case FPARAM_STR:
 		case FPARAM_STR:
 			/* nothing to do */
 			/* nothing to do */
-			return;
+			break;
 		case FPARAM_REGEX:
 		case FPARAM_REGEX:
 			if (fp->v.regex){
 			if (fp->v.regex){
 				regfree(fp->v.regex);
 				regfree(fp->v.regex);
@@ -1225,6 +1225,10 @@ void fparam_free_contents(fparam_t* fp)
 			}
 			}
 			break;
 			break;
 	}
 	}
+	if (fp->orig){
+		pkg_free(fp->orig);
+		fp->orig=0;
+	}
 }
 }