correct list allocation
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 27 Sep 2005 09:53:03 +0000 (09:53 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 27 Sep 2005 09:53:03 +0000 (09:53 +0000)
org.glite.jp.common/src/context.c

index 3da2f7a..f3b81b8 100644 (file)
@@ -132,11 +132,11 @@ int glite_jp_add_deferred(
 
        for (i=0; v && *v; i++);
 
-       ctx->deferred_func = realloc(ctx->deferred_func, (i+1) * sizeof *ctx->deferred_func);
+       ctx->deferred_func = realloc(ctx->deferred_func, (i+2) * sizeof *ctx->deferred_func);
        ctx->deferred_func[i] = func;
        ctx->deferred_func[i+1] = NULL;
 
-       ctx->deferred_arg = realloc(ctx->deferred_arg,(i+1) * sizeof *ctx->deferred_arg);
+       ctx->deferred_arg = realloc(ctx->deferred_arg,(i+2) * sizeof *ctx->deferred_arg);
        ctx->deferred_arg[i] = arg;
        ctx->deferred_arg[i+1] = NULL;