Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit994f68d

Browse files
author
Michael Meskes
committed
Return error if allocation of new element was not possible.
Found by Coverity.
1 parent3f092db commit994f68d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎src/interfaces/ecpg/pgtypeslib/numeric.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,18 @@ PGTYPESnumeric_to_asc(numeric *num, int dscale)
430430
numeric*numcopy=PGTYPESnumeric_new();
431431
char*s;
432432

433-
if (dscale<0)
434-
dscale=num->dscale;
433+
if (numcopy==NULL)
434+
returnNULL;
435435

436436
if (PGTYPESnumeric_copy(num,numcopy)<0)
437437
{
438438
PGTYPESnumeric_free(numcopy);
439439
returnNULL;
440440
}
441+
442+
if (dscale<0)
443+
dscale=num->dscale;
444+
441445
/* get_str_from_var may change its argument */
442446
s=get_str_from_var(numcopy,dscale);
443447
PGTYPESnumeric_free(numcopy);
@@ -1520,6 +1524,9 @@ numericvar_to_double(numeric *var, double *dp)
15201524
char*endptr;
15211525
numeric*varcopy=PGTYPESnumeric_new();
15221526

1527+
if (varcopy==NULL)
1528+
return-1;
1529+
15231530
if (PGTYPESnumeric_copy(var,varcopy)<0)
15241531
{
15251532
PGTYPESnumeric_free(varcopy);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp