]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - sshcrcda.c
Fix for `logging-save-default': allow logging settings to be saved with
[PuTTY.git] / sshcrcda.c
index 28210209b2496e451d7d1be1ac7a5bb5403a1769..7fb5767ce0a49e20bd09078501e3094f1203a05e 100644 (file)
@@ -63,7 +63,7 @@ struct crcda_ctx {
 
 void *crcda_make_context(void)
 {
-    struct crcda_ctx *ret = smalloc(sizeof(struct crcda_ctx));
+    struct crcda_ctx *ret = snew(struct crcda_ctx);
     ret->h = NULL;
     ret->n = HASH_MINSIZE / HASH_ENTRYSIZE;
     return ret;
@@ -118,11 +118,11 @@ int detect_attack(void *handle, uchar *buf, uint32 len, uchar *IV)
 
     if (ctx->h == NULL) {
         ctx->n = l;
-        ctx->h = (uint16 *) smalloc(ctx->n * HASH_ENTRYSIZE);
+        ctx->h = snewn(ctx->n, uint16);
     } else {
         if (l > ctx->n) {
             ctx->n = l;
-            ctx->h = (uint16 *) srealloc(ctx->h, ctx->n * HASH_ENTRYSIZE);
+            ctx->h = sresize(ctx->h, ctx->n, uint16);
         }
     }