Mercurial > hg > truffle
comparison src/share/vm/runtime/vmStructs.cpp @ 7584:c1c8479222cd
8005921: Memory leaks in vmStructs.cpp
Reviewed-by: dholmes, mikael, rasbold
Contributed-by: Jeremy Manson <jeremymanson@google.com>
author | dholmes |
---|---|
date | Thu, 10 Jan 2013 21:00:11 -0500 |
parents | 91bf7da5c609 |
children | 4a916f2ce331 |
comparison
equal
deleted
inserted
replaced
7583:91bf7da5c609 | 7584:c1c8479222cd |
---|---|
3110 char * s = new char[len]; | 3110 char * s = new char[len]; |
3111 strncpy(s, typeName, len - 1); | 3111 strncpy(s, typeName, len - 1); |
3112 s[len-1] = '\0'; | 3112 s[len-1] = '\0'; |
3113 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); | 3113 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); |
3114 if (recursiveFindType(origtypes, s, true) == 1) { | 3114 if (recursiveFindType(origtypes, s, true) == 1) { |
3115 delete s; | 3115 delete [] s; |
3116 return 1; | 3116 return 1; |
3117 } | 3117 } |
3118 delete s; | 3118 delete [] s; |
3119 } | 3119 } |
3120 const char* start = NULL; | 3120 const char* start = NULL; |
3121 if (strstr(typeName, "GrowableArray<") == typeName) { | 3121 if (strstr(typeName, "GrowableArray<") == typeName) { |
3122 start = typeName + strlen("GrowableArray<"); | 3122 start = typeName + strlen("GrowableArray<"); |
3123 } else if (strstr(typeName, "Array<") == typeName) { | 3123 } else if (strstr(typeName, "Array<") == typeName) { |
3129 char * s = new char[len]; | 3129 char * s = new char[len]; |
3130 strncpy(s, start, len - 1); | 3130 strncpy(s, start, len - 1); |
3131 s[len-1] = '\0'; | 3131 s[len-1] = '\0'; |
3132 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); | 3132 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); |
3133 if (recursiveFindType(origtypes, s, true) == 1) { | 3133 if (recursiveFindType(origtypes, s, true) == 1) { |
3134 delete s; | 3134 delete [] s; |
3135 return 1; | 3135 return 1; |
3136 } | 3136 } |
3137 delete s; | 3137 delete [] s; |
3138 } | 3138 } |
3139 if (strstr(typeName, "const ") == typeName) { | 3139 if (strstr(typeName, "const ") == typeName) { |
3140 const char * s = typeName + strlen("const "); | 3140 const char * s = typeName + strlen("const "); |
3141 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); | 3141 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); |
3142 if (recursiveFindType(origtypes, s, true) == 1) { | 3142 if (recursiveFindType(origtypes, s, true) == 1) { |
3146 if (strstr(typeName, " const") == typeName + len - 6) { | 3146 if (strstr(typeName, " const") == typeName + len - 6) { |
3147 char * s = strdup(typeName); | 3147 char * s = strdup(typeName); |
3148 s[len - 6] = '\0'; | 3148 s[len - 6] = '\0'; |
3149 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); | 3149 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); |
3150 if (recursiveFindType(origtypes, s, true) == 1) { | 3150 if (recursiveFindType(origtypes, s, true) == 1) { |
3151 free(s); | |
3151 return 1; | 3152 return 1; |
3152 } | 3153 } |
3154 free(s); | |
3153 } | 3155 } |
3154 if (!isRecurse) { | 3156 if (!isRecurse) { |
3155 tty->print_cr("type \"%s\" not found", typeName); | 3157 tty->print_cr("type \"%s\" not found", typeName); |
3156 } | 3158 } |
3157 return 0; | 3159 return 0; |