Changeset 1357 for trunk/print.c


Ignore:
Timestamp:
Jun 26, 2011 10:45:35 PM (2 years ago)
Author:
stefanct
Message:

fix memleaks due to incorrect usage of flashbuses_to_text

Signed-off-by: Stefan Tauner <stefan.tauner@…>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/print.c

    r1351 r1357  
    2929/* 
    3030 * Return a string corresponding to the bustype parameter. 
    31  * Memory is obtained with malloc() and can be freed with free(). 
     31 * Memory is obtained with malloc() and must be freed with free() by the caller. 
    3232 */ 
    3333char *flashbuses_to_text(enum chipbustype bustype) 
     
    8181        int maxchiplen = strlen("Device") + 1; 
    8282        const struct flashchip *f; 
     83        char *s; 
    8384 
    8485        for (f = flashchips; f->name != NULL; f++) { 
     
    153154                for (i = 0; i < 10 - digits(f->total_size); i++) 
    154155                        msg_ginfo(" "); 
    155                 msg_ginfo("%s\n", flashbuses_to_text(f->bustype)); 
     156 
     157                s = flashbuses_to_text(f->bustype); 
     158                msg_ginfo("%s\n", s); 
     159                free(s); 
    156160        } 
    157161} 
Note: See TracChangeset for help on using the changeset viewer.