From patchwork Mon May 28 18:27:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Holljes X-Patchwork-Id: 9132 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp2230867jad; Mon, 28 May 2018 11:27:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrLDR3z5qqUBYoXaKIeMbp3Yr+yK9hsUS67LxzfvdWNfbATNObpPYrAM9O1a1FuQ2DiqZb6 X-Received: by 2002:adf:dc8b:: with SMTP id r11-v6mr9973070wrj.263.1527532050270; Mon, 28 May 2018 11:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527532050; cv=none; d=google.com; s=arc-20160816; b=HMxgoz8qaefLIVmVY7x4KjrRhZIw0DCh/1oV206HFM0QOVDo+6EbADd94CgU2CVfVz D39JddifiXg2kZ1L46IlSL4zIS6CCgW1Pcts/nAYVteKO+FWVoLnGVVGNAnYtaFdZ48m jhtAI36mwY4U7eKTwrV0xhaNeyGb4BZt7EWdy6Deqk9Puyr1X/6i4ey+Rz2TyOH6UMAr grDxzHTtUk/JuAUURyvoocEv7ltR98i5t29VDns0OdlMYnz6Kw20AfGAoADHAvqWpONn AwXpXwgY56u0m5JwCb8UUrPmpMqHe1+QbugnjApQ9ESf09rVpt9bQlLk13+wpKnhPAwo SJNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=JAEqe0/q4POSM6ZvRsj6By/9cIYid/XgmJv+13IMmtE=; b=XB8v/Nc5O1h6ru9yXoBz59OpU3AthlZpyGHnHSyDy/1He+xbJc7gyX9qIWaKbIBqdS kNJ1QoGxltOS/VG9sMpHrEh//HZBWfA8CliM/JG9e/dKqqepoWmsfzRlgz/VaLy1jAv6 M4L2MSVgYFux0y40HNqucp6jFZyXnKsVPHuH/xYvhOcjo07vRNvOG6s+mWuQVCzD7p8F eQr8XAFpcsFjl2FB2TaY/e2pn1KtVhaHW+MxqkSpWsH6+b2BUyPLw1mhFpI8Xcr+kwKB O0lHm81SU9J2BWZ2aexW5sLISFg+CfSPlj2UufzF+KlRcMKTau/jUqf1H8GnDuwVP7X+ qX0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com header.s=20161025 header.b=HcMnUvHZ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o40-v6si11857674wrb.319.2018.05.28.11.27.29; Mon, 28 May 2018 11:27:30 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com header.s=20161025 header.b=HcMnUvHZ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4D7FF68A3B5; Mon, 28 May 2018 21:26:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C8E8268A376 for ; Mon, 28 May 2018 21:26:38 +0300 (EEST) Received: by mail-wr0-f177.google.com with SMTP id 94-v6so21567925wrf.5 for ; Mon, 28 May 2018 11:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6V4HzA4vCj/EdAJD8Jc57Hx7defKmT499y2bbDg/pNc=; b=HcMnUvHZt9sZaS8NhFdOmhqQx+x/S/aufWOrrEWnCUxLDuO9IEsvwTMR2PXfE2lRa2 NyX69NNHLTDIg4WF8rkTV59MlYQCoErbmWtBJa3zKQu2AJ5cIjio82jSvAQC8aU8gfyI 7kq87FJjKwuKNgal193fBDAwD3OqUnr/ZzJI8DOSeycgChb7pUYZcO4w485ZDAUZD2W/ wxRx5s2WS2C9pSnF7ZPP1YnsYu+/a/1c6F6k0PiS5+cZClF0RHQD8LI7k42n3LsNobDy 5tJXrflQ21UpV3FaKxiveb2k7b8J5egl8I3TkQOJiST0KewFrNDGjPLl84+ynKnKoaC0 852Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6V4HzA4vCj/EdAJD8Jc57Hx7defKmT499y2bbDg/pNc=; b=Lpb9GxVaNOS/GiQRK88hCNll1Ghl40yiu1nQOPc61j1ZrK/mZXp4J1KmOB6A0xJgg+ XUJsMwFds8g4Sj77m/AkqsRFptD2GWaVnkOjunvJ6OZH/iIlWED0mkz88xsoAiDy1Tpd SxSbnYHuOTuNnDUGnEcctKoO+H6fjHZx1hKxL8L14WHnry/RD1jOOx3OyAUP8vb1VJi2 IHZ5rGMuaz7S+CB9+H+cLdAkCZlllExxu1jzuuimkQRQbxBhOatjKyFZcNwTEjNGI2K0 xh//QbBrGzTT2mjIVRHHjsScTWik4x1exDAWx3nFrddCGpriRDFClERsP6yaWkI8yyIa 4zYg== X-Gm-Message-State: ALKqPwcw6+omWodvmIMAwUO4tlqLArhfFnY4WdI7iKkuLqBdmUfTfFHw 8d1uTIaWPVvEvu2ogaSL3FC2ig== X-Received: by 2002:adf:dd8c:: with SMTP id x12-v6mr8692360wrl.212.1527532041754; Mon, 28 May 2018 11:27:21 -0700 (PDT) Received: from localhost.localdomain ([46.5.2.0]) by smtp.gmail.com with ESMTPSA id g205-v6sm4126285wmg.43.2018.05.28.11.27.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 11:27:20 -0700 (PDT) From: Stephan Holljes To: ffmpeg-devel@ffmpeg.org Date: Mon, 28 May 2018 20:27:02 +0200 Message-Id: <20180528182711.3221-2-klaxa1337@googlemail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180528182711.3221-1-klaxa1337@googlemail.com> References: <20180528182711.3221-1-klaxa1337@googlemail.com> Subject: [FFmpeg-devel] [PATCH 01/10] ffserver.c: Replace av_malloc with av_mallocz_array X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Stephan Holljes MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Stephan Holljes --- ffserver.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ffserver.c b/ffserver.c index 12c257f..5fc7c44 100644 --- a/ffserver.c +++ b/ffserver.c @@ -509,8 +509,8 @@ void *run_server(void *arg) { pthread_t *r_threads; pthread_t **w_threads_p; - pubs = av_mallocz(config->nb_streams * sizeof(struct PublisherContext*)); - ifmt_ctxs = av_mallocz(config->nb_streams * sizeof(AVFormatContext*)); + pubs = av_mallocz_array(config->nb_streams, sizeof(struct PublisherContext*)); + ifmt_ctxs = av_mallocz_array(config->nb_streams, sizeof(AVFormatContext*)); av_log_set_level(AV_LOG_INFO); @@ -520,10 +520,10 @@ void *run_server(void *arg) { ainfo.httpd = &lavfhttpd; ainfo.config = config; - rinfos = av_mallocz(config->nb_streams * sizeof(struct ReadInfo)); - winfos_p = av_mallocz(config->nb_streams * sizeof(struct WriteInfo*)); - r_threads = av_mallocz(config->nb_streams * sizeof(pthread_t)); - w_threads_p = av_mallocz(config->nb_streams * sizeof(pthread_t*)); + rinfos = av_mallocz_array(config->nb_streams, sizeof(struct ReadInfo)); + winfos_p = av_mallocz_array(config->nb_streams, sizeof(struct WriteInfo*)); + r_threads = av_mallocz_array(config->nb_streams, sizeof(pthread_t)); + w_threads_p = av_mallocz_array(config->nb_streams, sizeof(pthread_t*)); for (stream_index = 0; stream_index < config->nb_streams; stream_index++) { struct PublisherContext *pub = NULL; @@ -549,8 +549,8 @@ void *run_server(void *arg) { rinfos[stream_index] = rinfo; - w_threads = av_malloc(sizeof(pthread_t) * pub->nb_threads); - winfos = av_malloc(sizeof(struct WriteInfo) * pub->nb_threads); + w_threads = av_mallocz_array(pub->nb_threads, sizeof(pthread_t)); + winfos = av_mallocz_array(pub->nb_threads, sizeof(struct WriteInfo)); w_threads_p[stream_index] = w_threads; winfos_p[stream_index] = winfos; @@ -608,7 +608,7 @@ int main(int argc, char *argv[]) printf("No valid configurations parsed.\n"); return 1; } - server_threads = av_malloc(nb_configs * sizeof(pthread_t)); + server_threads = av_mallocz_array(nb_configs, sizeof(pthread_t)); for (i = 0; i < nb_configs; i++) { config_dump(configs + i); pthread_create(&server_threads[i], NULL, run_server, configs + i);