* ipproto. */
const char *alproto_names[ALPROTO_MAX];
- /* Protocol expectations, like ftp-data on tcp */
- uint8_t expectation_proto[ALPROTO_MAX];
+ /* Protocol expectations, like ftp-data on tcp.
+ * It should be allocated to contain ALPROTO_MAX
+ * app-layer protocols. For each protocol, an iptype
+ * is referenced (or 0 if there is no expectation). */
+ uint8_t *expectation_proto;
} AppLayerProtoDetectCtx;
typedef struct AppLayerProtoDetectAliases_ {
}
}
+ // to realloc when dynamic protos are added
+ alpd_ctx.expectation_proto = SCCalloc(ALPROTO_MAX, sizeof(uint8_t));
+ if (unlikely(alpd_ctx.expectation_proto == NULL)) {
+ FatalError("Unable to alloc expectation_proto.");
+ }
AppLayerExpectationSetup();
SCReturnInt(0);
}
}
+ SCFree(alpd_ctx.expectation_proto);
+ alpd_ctx.expectation_proto = NULL;
+
SpmDestroyGlobalThreadCtx(alpd_ctx.spm_global_thread_ctx);
AppLayerProtoDetectFreeAliases();