Changeset 631d254 in rtems


Ignore:
Timestamp:
Sep 2, 2015, 9:54:23 PM (4 years ago)
Author:
Martin Galvan <martin.galvan@…>
Branches:
4.11
Children:
9e2197d
Parents:
c62129c5
git-author:
Martin Galvan <martin.galvan@…> (09/02/15 21:54:23)
git-committer:
Joel Sherrill <joel.sherrill@…> (09/03/15 17:34:01)
Message:

tools/cpu/nios2/ptf.c: Fix leak of memory pointed to by new_prefix

Updates #2405.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/cpu/nios2/ptf.c

    rc62129c5 r631d254  
    568568        };
    569569        new_prefix = (char *)malloc(new_prefix_len);
    570         strcpy(new_prefix, prefix);
    571         strcat(new_prefix, leaf->name);
    572         if(leaf->value != NULL && leaf->value[0] != 0)
    573         {
    574           strcat(new_prefix, ":");
    575           strcat(new_prefix, leaf->value);
    576         };
    577         strcat(new_prefix, "/");
    578         fputs(new_prefix, s);
    579         fputs("\n", s);
    580         ptf_printf(s, leaf->sub, new_prefix);
     570        if (new_prefix != NULL)
     571        {
     572          strcpy(new_prefix, prefix);
     573          strcat(new_prefix, leaf->name);
     574          if(leaf->value != NULL && leaf->value[0] != 0)
     575          {
     576            strcat(new_prefix, ":");
     577            strcat(new_prefix, leaf->value);
     578          };
     579          strcat(new_prefix, "/");
     580          fputs(new_prefix, s);
     581          fputs("\n", s);
     582          ptf_printf(s, leaf->sub, new_prefix);
     583          free(new_prefix);
     584        }
    581585        break;
    582586      };
Note: See TracChangeset for help on using the changeset viewer.