Browse code

* fixed memory leak in fix_param()

Ondrej Martinek authored on 18/10/2007 16:42:54
Showing 1 changed files
... ...
@@ -676,6 +676,11 @@ int fix_flag( modparam_t type, void* val,
676 676
  * Generic parameter fixup function which creates
677 677
  * fparam_t structure. type parameter contains allowed
678 678
  * parameter types
679
+ *
680
+ * Returns:
681
+ *    0 on success, 
682
+ *    1 if the param doesn't match the specified type
683
+ *    <0 on failure
679 684
  */
680 685
 int fix_param(int type, void** param)
681 686
 {
... ...
@@ -713,7 +718,7 @@ int fix_param(int type, void** param)
713 713
 	if (err == 0) {
714 714
 	    p->v.i = (int)num;
715 715
 	} else {
716
-		 /* Not a number */
716
+	    /* Not a number */
717 717
 	    pkg_free(p);
718 718
 	    return 1;
719 719
 	}
... ...
@@ -736,7 +741,7 @@ int fix_param(int type, void** param)
736 736
 	name.len = strlen(name.s);
737 737
 	trim(&name);
738 738
 	if (!name.len || name.s[0] != '$') {
739
-		 /* Not an AVP identifier */
739
+	    /* Not an AVP identifier */
740 740
 	    pkg_free(p);
741 741
 	    return 1;
742 742
 	}
... ...
@@ -754,7 +759,7 @@ int fix_param(int type, void** param)
754 754
 	name.len = strlen(name.s);
755 755
 	trim(&name);
756 756
 	if (!name.len || name.s[0] != '@') {
757
-		 /* Not a select identifier */
757
+	    /* Not a select identifier */
758 758
 	    pkg_free(p);
759 759
 	    return 1;
760 760
 	}
... ...
@@ -771,7 +776,7 @@ int fix_param(int type, void** param)
771 771
 	p->v.subst = subst_parser(&s);
772 772
 	if (!p->v.subst) {
773 773
 	    ERR("Error while parsing regex substitution\n");
774
-	    return -1;
774
+	    goto error;
775 775
 	}
776 776
 	break;
777 777
     }