diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2014-01-05 21:50:18 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2014-01-05 21:50:18 +0000 |
commit | 42cbc92b762590268ea9efea862a192b78d04f73 (patch) | |
tree | 66677be57553d8036241ff0930624ff911ec550a /camlibs/sq905 | |
parent | 33473cf6382b51008d4ae820388d071a8ce2e815 (diff) | |
download | libgphoto2-42cbc92b762590268ea9efea862a192b78d04f73.tar.gz |
do not realloc if not needed
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14641 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'camlibs/sq905')
-rw-r--r-- | camlibs/sq905/sq905.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/camlibs/sq905/sq905.c b/camlibs/sq905/sq905.c index 53f7c013c..c72add5ec 100644 --- a/camlibs/sq905/sq905.c +++ b/camlibs/sq905/sq905.c @@ -91,10 +91,12 @@ sq_init (GPPort *port, CameraPrivateLibrary *priv) /* The first occurence of a zero denotes end of files entries (here clips count as 1 entry) */ for (i=0; i<0x4000 && catalog[i]; i+=16) ; priv->nb_entries = i>>4; - catalog_tmp = realloc(catalog, i); if (i) { - if (catalog_tmp) priv->catalog = catalog_tmp; - else priv->catalog = catalog; + catalog_tmp = realloc(catalog, i); + if (catalog_tmp) + priv->catalog = catalog_tmp; + else + priv->catalog = catalog; } else { priv->catalog = NULL; /* We just have freed catalog_tmp */ } |