View | Details | Raw Unified | Return to bug 54343
Collapse All | Expand All

(-)service.c.orig (+22 lines)
Lines 331-336 Link Here
331
331
332
        mpm_new_argv->nalloc = mpm_new_argv->nelts + argc - 1;
332
        mpm_new_argv->nalloc = mpm_new_argv->nelts + argc - 1;
333
        cmb_data = malloc(mpm_new_argv->nalloc * sizeof(const char *));
333
        cmb_data = malloc(mpm_new_argv->nalloc * sizeof(const char *));
334
        if (cmb_data == NULL) {
335
            /* the fprintf below should be replaced with the appropriate call to ap_log_error() */
336
337
            fprintf(stderr, "Unable to allocate memory for cmb_data in service_nt_main_fn()\n");
338
            return;
339
        }
334
340
335
        /* mpm_new_argv remains first (of lower significance) */
341
        /* mpm_new_argv remains first (of lower significance) */
336
        memcpy (cmb_data, mpm_new_argv->elts,
342
        memcpy (cmb_data, mpm_new_argv->elts,
Lines 351-356 Link Here
351
    SetEvent(ctx->service_init);
357
    SetEvent(ctx->service_init);
352
358
353
    WaitForSingleObject(ctx->service_term, INFINITE);
359
    WaitForSingleObject(ctx->service_term, INFINITE);
360
361
    free(cmd_data); /* release memory previously allocated by malloc() */
354
}
362
}
355
363
356
364
Lines 454-459 Link Here
454
     */
462
     */
455
    args->nalloc = args->nelts + svc_args->nelts;
463
    args->nalloc = args->nelts + svc_args->nelts;
456
    cmb_data = malloc(args->nalloc * sizeof(const char *));
464
    cmb_data = malloc(args->nalloc * sizeof(const char *));
465
    if (cmb_data == NULL) {
466
        /* the fprintf below should be replaced with the appropriate call to ap_log_error() */
467
        fprintf(stderr, "Unable to allocate memory for cmb_data in mpm_merge_service_args()\n");
468
        return;
469
    }
457
470
458
    /* First three args (argv[0], -f, path) remain first */
471
    /* First three args (argv[0], -f, path) remain first */
459
    memcpy(cmb_data, args->elts, args->elt_size * fixed_args);
472
    memcpy(cmb_data, args->elts, args->elt_size * fixed_args);
Lines 470-475 Link Here
470
    args->elts = (char *)cmb_data;
483
    args->elts = (char *)cmb_data;
471
    args->nelts = args->nalloc;
484
    args->nelts = args->nalloc;
472
485
486
    free(cmb_data); /* release memory previously allocated by malloc() */
487
473
    return APR_SUCCESS;
488
    return APR_SUCCESS;
474
}
489
}
475
490
Lines 786-791 Link Here
786
    }
801
    }
787
802
788
    start_argv = malloc((argc + 1) * sizeof(const char **));
803
    start_argv = malloc((argc + 1) * sizeof(const char **));
804
    if (start_argv == NULL) {
805
        /* the fprintf below should be replaced with the appropriate call to ap_log_error() */
806
        fprintf(stderr, "Unable to allocate memory for start_argv in mpm_service_start()\n");
807
        return;
808
    }
789
    memcpy(start_argv, argv, argc * sizeof(const char **));
809
    memcpy(start_argv, argv, argc * sizeof(const char **));
790
    start_argv[argc] = NULL;
810
    start_argv[argc] = NULL;
791
811
Lines 809-814 Link Here
809
                     "%s: Failed to start the service process.",
829
                     "%s: Failed to start the service process.",
810
                     mpm_display_name);
830
                     mpm_display_name);
811
831
832
    free(start_argv);   /* release memory previously allocated by malloc() */
833
812
    return rv;
834
    return rv;
813
}
835
}
814
836

Return to bug 54343