Revision: 57284
http://sourceforge.net/p/brlcad/code/57284
Author: mohitdaga
Date: 2013-08-29 22:31:09 +0000 (Thu, 29 Aug 2013)
Log Message:
-----------
Allocate image structure before the process starts.
Modified Paths:
--------------
brlcad/trunk/src/libicv/bw.c
brlcad/trunk/src/libicv/pix.c
Modified: brlcad/trunk/src/libicv/bw.c
===================================================================
--- brlcad/trunk/src/libicv/bw.c 2013-08-29 22:22:49 UTC (rev 57283)
+++ brlcad/trunk/src/libicv/bw.c 2013-08-29 22:31:09 UTC (rev 57284)
@@ -92,7 +92,8 @@
bu_log("bw_read: Cannot open %s for reading\n", filename);
return NULL;
}
-
+ BU_ALLOC(bif, struct icv_image);
+ ICV_IMAGE_INIT(bif);
/* buffer pixel wise */
if (width == 0 || height == 0) {
int status = 0;
@@ -116,13 +117,12 @@
if (read(fd, data, size) < 0) {
bu_log("bw_read: Error Occurred while Reading\n");
bu_free(data, "icv_image data");
+ bu_free(bif, "icv_structure");
return NULL;
}
bif->height = height;
bif->width = width;
}
- BU_ALLOC(bif, struct icv_image);
- ICV_IMAGE_INIT(bif);
bif->data = uchar2double(data, size);
bu_free(data, "bw_read : unsigned char data");
bif->magic = ICV_IMAGE_MAGIC;
Modified: brlcad/trunk/src/libicv/pix.c
===================================================================
--- brlcad/trunk/src/libicv/pix.c 2013-08-29 22:22:49 UTC (rev 57283)
+++ brlcad/trunk/src/libicv/pix.c 2013-08-29 22:31:09 UTC (rev 57284)
@@ -89,7 +89,8 @@
bu_log("pix_read: Cannot open file for reading\n");
return NULL;
}
-
+ BU_ALLOC(bif, struct icv_image);
+ ICV_IMAGE_INIT(bif);
/* buffer pixel wise */
if (width == 0 || height == 0) {
int status = 0;
@@ -113,13 +114,12 @@
if (read(fd, data, size) < 0) {
bu_log("pix_read: Error Occurred while Reading\n");
bu_free(data, "icv_image data");
+ bu_free(bif, "icv_structure");
return NULL;
}
bif->height = height;
bif->width = width;
}
- BU_ALLOC(bif, struct icv_image);
- ICV_IMAGE_INIT(bif);
bif->data = uchar2double(data, size);
bu_free(data, "pix_read : unsigned char data");
bif->magic = ICV_IMAGE_MAGIC;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits