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

Commit1b7f516

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

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
@@ -402,14 +402,18 @@ PGTYPESnumeric_to_asc(numeric *num, int dscale)
402402
numeric*numcopy=PGTYPESnumeric_new();
403403
char*s;
404404

405-
if (dscale<0)
406-
dscale=num->dscale;
405+
if (numcopy==NULL)
406+
returnNULL;
407407

408408
if (PGTYPESnumeric_copy(num,numcopy)<0)
409409
{
410410
PGTYPESnumeric_free(numcopy);
411411
returnNULL;
412412
}
413+
414+
if (dscale<0)
415+
dscale=num->dscale;
416+
413417
/* get_str_from_var may change its argument */
414418
s=get_str_from_var(numcopy,dscale);
415419
PGTYPESnumeric_free(numcopy);
@@ -1493,6 +1497,9 @@ numericvar_to_double(numeric *var, double *dp)
14931497
char*endptr;
14941498
numeric*varcopy=PGTYPESnumeric_new();
14951499

1500+
if (varcopy==NULL)
1501+
return-1;
1502+
14961503
if (PGTYPESnumeric_copy(var,varcopy)<0)
14971504
{
14981505
PGTYPESnumeric_free(varcopy);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp