Only free pContext once when AddResource fails in ProcRecordCreateContext
Since RecordDeleteContext frees its argument, don't fall through to free it again. Error: Double free (CWE 415) Double free of pointer 'malloc(1072)' defined by malloc at line 1964 of record/record.c in function 'ProcRecordCreateContext'. Previously freed at line 1960 with RecordDeleteContext. 'malloc(1072)' was allocated at line 1926 with malloc. [ This bug was found by the Parfait 0.3.7 bug checking tool. For more information see http://labs.oracle.com/projects/parfait/ ] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
8d229c4cf9
commit
dadb0791eb
|
@ -1958,7 +1958,7 @@ ProcRecordCreateContext(ClientPtr client)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RecordDeleteContext((pointer)pContext, pContext->id);
|
RecordDeleteContext((pointer)pContext, pContext->id);
|
||||||
err = BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
bailout:
|
bailout:
|
||||||
free(pContext);
|
free(pContext);
|
||||||
|
|
Loading…
Reference in New Issue