image: Fix memory leaks
This commit is contained in:
1 parent
23b916bcc9
commit
dfc021d7c4
1 file changed
+4
-3
+4
-3
@@ -88,14 +88,13 @@ static void image_missing_values_from_name(struct image * image, const char * na
|
|||||||
|
|
||||||
if ( image->devices && image->devices->device && ! image->devices->hwrevs )
|
if ( image->devices && image->devices->device && ! image->devices->hwrevs )
|
||||||
image->devices->hwrevs = hwrevs_alloc_from_string(hwrevs);
|
image->devices->hwrevs = hwrevs_alloc_from_string(hwrevs);
|
||||||
else
|
|
||||||
free(hwrevs);
|
|
||||||
|
|
||||||
if ( ! image->version )
|
if ( ! image->version )
|
||||||
image->version = version;
|
image->version = version;
|
||||||
else
|
else
|
||||||
free(version);
|
free(version);
|
||||||
|
|
||||||
|
free(hwrevs);
|
||||||
free(str);
|
free(str);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -135,8 +134,10 @@ char * image_name_alloc_from_values(struct image * image) {
|
|||||||
length += 1 + strlen(image->version);
|
length += 1 + strlen(image->version);
|
||||||
|
|
||||||
name = calloc(1, length);
|
name = calloc(1, length);
|
||||||
if ( ! name )
|
if ( ! name ) {
|
||||||
|
free(hwrevs);
|
||||||
ALLOC_ERROR_RETURN(NULL);
|
ALLOC_ERROR_RETURN(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
strcpy(name, type);
|
strcpy(name, type);
|
||||||
ptr = name + strlen(name);
|
ptr = name + strlen(name);
|
||||||
|
|||||||
Reference in new issue
Block a user