From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 748DBA04DD; Wed, 28 Oct 2020 16:59:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5739ACC78; Wed, 28 Oct 2020 16:59:21 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 7A954CC78 for ; Wed, 28 Oct 2020 16:59:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603900758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Jpeaj6Ju/j67CNvMSW+tM+ovoKiSbNR932KItKrtFqw=; b=IY3A3b2S/jfwE1IBHNzgoabL4/qCh8WbfYkznwVPsKpTKbiXBUeQW++McQjdVbS7hfXW+6 7W63yuP4FSh8iLieraTqcEU9UOMsPaa8vBI/JOnjJZjHnp52T62Ixam8JYvCqed0zIPJnY 6T5yq/CT2bZMPAvOggFw8OCYKZPOYVw= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-5-AVlXHco3NquxeLEoMEwMDg-1; Wed, 28 Oct 2020 11:59:13 -0400 X-MC-Unique: AVlXHco3NquxeLEoMEwMDg-1 Received: by mail-vs1-f71.google.com with SMTP id k22so1121115vsg.5 for ; Wed, 28 Oct 2020 08:59:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Jpeaj6Ju/j67CNvMSW+tM+ovoKiSbNR932KItKrtFqw=; b=VL4Wi5mRQRHn6VdbybZQ7heWYUms6SSdtyBRekaqdC8f22UG/uPM3VLnJ/UmQ1IzFd hM6IvFgLtFVtGd/ayyGDCyTBO+P3QMUBt4aj/3xMpPtaZDwmUVjA+2jykl2Z9Yk/0R1+ ymsbyo5wZGKdKZZEkYMRPcAUv+IB5KIcWxoncR+wcLBf7BmyTHVsW/QVAGFpkJlOcYRP 3nwHs2zb1eG4lfIm//9kpvMyxjiE6e4RnMaw3WeZ5+h/yiudGlr07h7HHKv1hvYpwCJq 3fX/IZ5GIQmKCWrcm2xVr6IaAj8TcpC125hqghxdot60TooVXifkNql3+raTfN7bviUa zasg== X-Gm-Message-State: AOAM531DLG3Ts/l9dsZQ5muTJPjfuXbpBkQhI1C5edtbeDfl9W6YrMI5 kmdpC+fYFdFyec1OUKbxUTOaCAurQt3yAfXr2R5VsmAoVUZb4KiWKPOSFh7h+c0NP4ByvfxPb0x R/5CTpPcn/l/e+6Qfh1A= X-Received: by 2002:a1f:1889:: with SMTP id 131mr61871vky.20.1603900752800; Wed, 28 Oct 2020 08:59:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKZ42vv6lx9ZNPsIKORUxKWR9MIYFP4l5zJrAERTNEt7LU4K6rQ9Ij21HLO2WnbxAJaAiVcWLAWgHe6SuBnuw= X-Received: by 2002:a1f:1889:: with SMTP id 131mr61861vky.20.1603900752575; Wed, 28 Oct 2020 08:59:12 -0700 (PDT) MIME-Version: 1.0 References: <20201023080058.13335-1-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Wed, 28 Oct 2020 16:59:01 +0100 Message-ID: To: Jerin Jacob Cc: Jerin Jacob Kollanukkaran , Sunil Kumar Kori , dev Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 0/3] Rework CTF event description storage X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Oct 28, 2020 at 4:17 PM David Marchand wrote: > This fixes it: > @@ -37,11 +37,12 @@ meta_copy(char **meta, int *offset, char *str, int rc) > if (rc < 0) > return rc; > > - ptr = realloc(ptr, count + rc); > + ptr = realloc(ptr, count + rc + 1); > if (ptr == NULL) > goto free_str; > > memcpy(RTE_PTR_ADD(ptr, count), str, rc); > + ptr[count + rc] = '\0'; > count += rc; > free(str); > The other alternative is to prefer libc string formatting functions rather than plain memory alloc + copy + manual null termination: https://github.com/david-marchand/dpdk/commit/traces -- David Marchand