Browse code

fix minor leak

Török Edvin authored on 2009/07/01 01:40:26
Showing 1 changed files
... ...
@@ -69,12 +69,14 @@ int main(int argc, char *argv[])
69 69
     f = fopen(argv[1], "r");
70 70
     if (!f) {
71 71
 	fprintf(stderr, "Unable to load %s\n", argv[1]);
72
+	optfree(opts);
72 73
 	exit(2);
73 74
     }
74 75
 
75 76
     bc = malloc(sizeof(*bc));
76 77
     if (!bc) {
77 78
 	fprintf(stderr, "Out of memory\n");
79
+	optfree(opts);
78 80
 	exit(3);
79 81
     }
80 82
 
... ...
@@ -82,6 +84,7 @@ int main(int argc, char *argv[])
82 82
     rc = cli_bytecode_load(bc, f, NULL);
83 83
     if (rc != CL_SUCCESS) {
84 84
 	fprintf(stderr,"Unable to load bytecode: %s\n", cl_strerror(rc));
85
+	optfree(opts);
85 86
 	exit(4);
86 87
     }
87 88
     fclose(f);
... ...
@@ -99,5 +102,6 @@ int main(int argc, char *argv[])
99 99
     cli_bytecode_destroy_context(ctx);
100 100
     cli_bytecode_destroy(bc);
101 101
     free(bc);
102
+    optfree(opts);
102 103
     return 0;
103 104
 }