Browse code

Fix const-related warnings on convenience_ctx()

David Raynor authored on 2013/02/15 01:20:50
Showing 1 changed files
... ...
@@ -54,6 +54,7 @@ typedef struct mac_token2_tag
54 54
 
55 55
 cli_ctx *convenience_ctx(int fd) {
56 56
     cli_ctx *ctx;
57
+    struct cl_engine *engine;
57 58
 
58 59
     ctx = malloc(sizeof(*ctx));
59 60
     if(!ctx){
... ...
@@ -61,7 +62,7 @@ cli_ctx *convenience_ctx(int fd) {
61 61
         return NULL;
62 62
     }
63 63
 
64
-    ctx->engine = cl_engine_new();
64
+    ctx->engine = engine = cl_engine_new();
65 65
     if(!(ctx->engine)){	    
66 66
 	printf("engine malloc failed\n");
67 67
         free(ctx);
... ...
@@ -71,7 +72,7 @@ cli_ctx *convenience_ctx(int fd) {
71 71
     ctx->fmap = cli_malloc(sizeof(struct F_MAP *));
72 72
     if(!(ctx->fmap)){
73 73
 	printf("fmap malloc failed\n");
74
-        free(ctx->engine);
74
+        free(engine);
75 75
         free(ctx);
76 76
 	return NULL;
77 77
     }
... ...
@@ -79,7 +80,7 @@ cli_ctx *convenience_ctx(int fd) {
79 79
     if(!(*ctx->fmap = fmap(fd, 0, 0))){
80 80
 	printf("fmap failed\n");
81 81
 	free(ctx->fmap);
82
-	free(ctx->engine);
82
+	free(engine);
83 83
         free(ctx);
84 84
 	return NULL;
85 85
     }