mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-22 05:47:31 +02:00
Fix a memory leak when the dump file cannot be opened
This commit is contained in:
+3
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2014 Stephen Williams ([email protected])
|
* Copyright (c) 1999-2015 Stephen Williams ([email protected])
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
@@ -372,6 +372,8 @@ static void open_dumpfile(vpiHandle callh)
|
|||||||
(int)vpi_get(vpiLineNo, callh));
|
(int)vpi_get(vpiLineNo, callh));
|
||||||
vpi_printf("Unable to open %s for output.\n", dump_path);
|
vpi_printf("Unable to open %s for output.\n", dump_path);
|
||||||
vpi_control(vpiFinish, 1);
|
vpi_control(vpiFinish, 1);
|
||||||
|
free(dump_path);
|
||||||
|
dump_path = 0;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
int prec = vpi_get(vpiTimePrecision, 0);
|
int prec = vpi_get(vpiTimePrecision, 0);
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2014 Stephen Williams ([email protected])
|
* Copyright (c) 2002-2015 Stephen Williams ([email protected])
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
@@ -450,6 +450,8 @@ static void open_dumpfile(vpiHandle callh)
|
|||||||
(int)vpi_get(vpiLineNo, callh));
|
(int)vpi_get(vpiLineNo, callh));
|
||||||
vpi_printf("Unable to open %s for output.\n", dump_path);
|
vpi_printf("Unable to open %s for output.\n", dump_path);
|
||||||
vpi_control(vpiFinish, 1);
|
vpi_control(vpiFinish, 1);
|
||||||
|
free(dump_path);
|
||||||
|
dump_path = 0;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
int prec = vpi_get(vpiTimePrecision, 0);
|
int prec = vpi_get(vpiTimePrecision, 0);
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2014 Stephen Williams ([email protected])
|
* Copyright (c) 2003-2015 Stephen Williams ([email protected])
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
@@ -503,6 +503,8 @@ static void open_dumpfile(vpiHandle callh)
|
|||||||
(int)vpi_get(vpiLineNo, callh));
|
(int)vpi_get(vpiLineNo, callh));
|
||||||
vpi_printf("Unable to open %s for output.\n", dump_path);
|
vpi_printf("Unable to open %s for output.\n", dump_path);
|
||||||
vpi_control(vpiFinish, 1);
|
vpi_control(vpiFinish, 1);
|
||||||
|
free(dump_path);
|
||||||
|
dump_path = 0;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
int prec = vpi_get(vpiTimePrecision, 0);
|
int prec = vpi_get(vpiTimePrecision, 0);
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2014 Stephen Williams ([email protected])
|
* Copyright (c) 1999-2015 Stephen Williams ([email protected])
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
@@ -410,6 +410,8 @@ static void open_dumpfile(vpiHandle callh)
|
|||||||
(int)vpi_get(vpiLineNo, callh));
|
(int)vpi_get(vpiLineNo, callh));
|
||||||
vpi_printf("Unable to open %s for output.\n", dump_path);
|
vpi_printf("Unable to open %s for output.\n", dump_path);
|
||||||
vpi_control(vpiFinish, 1);
|
vpi_control(vpiFinish, 1);
|
||||||
|
free(dump_path);
|
||||||
|
dump_path = 0;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
int prec = vpi_get(vpiTimePrecision, 0);
|
int prec = vpi_get(vpiTimePrecision, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user